0

I use the following docker file which works as expected The project is a cli and when I run command docker run -it cli I got error from the cli (which is ok since the entry point is just running fzr ENTRYPOINT ["./fzr”])

Typically I run in on my machine like fzr -help or fzr version etc

I want that when I use command like docker run -it cli that I will be able to run commands inside the container

like fzr -help and fzr version, how can I do that ?

FROM golang:1.10.5 AS build-env


ADD https://github.com/golang/dep/releases/download/v0.4.2/dep-linux-amd64 /usr/bin/dep
RUN chmod +x /usr/bin/dep

RUN mkdir -p $GOPATH/src/github.com/fzr
WORKDIR  $GOPATH/src/github.com/fzr


COPY Gopkg.toml Gopkg.lock ./

# install project dep
RUN dep ensure 

COPY . ./

RUN  go build  -o /fzr

FROM scratch
COPY --from=build-env /fzr ./
ENTRYPOINT ["./fzr"]
2
  • docker exec -it --rm cli fzr version Commented Dec 4, 2018 at 19:55
  • What’s actually going wrong? What’s the actual docker run command and its actual output? Commented Dec 4, 2018 at 20:13

1 Answer 1

1

TL;DR; docker run -it cli version

If you set ENTRYPOINT to your binary then everything that you pass after image name will be used as arg to that binary. If for some reason you need to overwrite entrypoint use --entrypoint flag to docker run.

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

1 Comment

Since it’s a FROM scratch image, there’s nothing else you can possibly set the entrypoint to. You cannot, for example, get a shell in the container because there’s no /bin/sh.

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.