1

My Dockerfile contents are as follows:

FROM amd64/ubuntu:xenial-20180726

ARG GETH_REPO="https://github.com/ethereum/go-ethereum"
ARG GETH_VERSION="v1.8.12"


CMD ["/bin/bash", "-c", "git clone ${GETH_REPO} && \ 
        cd go-ethereum && \
        git fetch origin ${GETH_VERSION} && \
        git checkout ${GETH_VERSION} && \
        make geth && \
        touch /var/log/geth_log"]

Basically, I want to download from the repository and build. However, when I run the created image I get the following error

$ docker run -it <imageid>
/bin/sh: 1: [/bin/bash,: not found

I have made sure that I can execute these operations by logging into the running container.

Am I missing something?

1 Answer 1

1

Your json syntax is invalid, so docker is running it as a string with a shell, instead of execing it. There's nothing in your command that requires bash, so you can use the default /bin/sh with the string syntax:

FROM amd64/ubuntu:xenial-20180726

ARG GETH_REPO="https://github.com/ethereum/go-ethereum"
ARG GETH_VERSION="v1.8.12"

RUN git clone ${GETH_REPO} && \ 
        cd go-ethereum && \
        git fetch origin ${GETH_VERSION} && \
        git checkout ${GETH_VERSION} && \
        make geth && \
        touch /var/log/geth_log

Note that all of your steps are being run as the default start command for the container, rather than being performed at build time. You likely want to replace CMD with RUN.

Sign up to request clarification or add additional context in comments.

2 Comments

I tried that and I get the following error ` $ docker run -it 19bd08d6fa2d You must specify a repository to clone. usage: git clone [<options>] [--] <repo> [<dir>] ` Is there a need to provide the value of GETH_REPO during run? (default value provided)
Build args only apply at build time. Do you want these commands to run at build time when you make the image, or at run time every time you create the container?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.