-1

I have the following ENTRYPOINT in my Dockerfile:

ENTRYPOINT["/setup.sh"]

I need to run a container without running setup.sh and run install.sh.
How do I do it?

PersianGulf
  • 2,845
  • 6
  • 47
  • 67
  • 2
    [Override the entrypoint (`docs.docker.com`)](https://docs.docker.com/engine/reference/run/#entrypoint-default-command-to-execute-at-runtime). – Turing85 May 08 '22 at 14:49
  • 1
    If you change `ENTRYPOINT` to `CMD`, then you can very easily `docker run your-image /app/another_command --with-options` without special Docker syntax. An installation script you also may want to `RUN` in the Dockerfile, instead of at container startup time. – David Maze May 08 '22 at 15:37
  • Rename the question: how to override an image's dockerfile entrypoint ? – Bguess May 09 '22 at 04:52

1 Answers1

1

Just change your docker entrypoint when executing docker run :

docker run -d --rm --entrypoint WHATEVER_COMMAND_YOU_WANT image_name

It will replace your dockerfile' entrypoint.

Bguess
  • 1,700
  • 1
  • 11
  • 24
  • However it was solved my problem. But if a Docekerfile has more than one `ENTRYPOINT` and user only want to discard one `ENTRYPOINT`, How can user do it? for exampe entpoint1 entpoint2 and entpoint3. And user want to run entpint1 and entpoint2 and discard entpoint3. – PersianGulf May 10 '22 at 06:04
  • 1
    An entrypoint is unique, it cannot be 2 entrypoints in one dockerfile, otherwise one will override the other. But it can be an entrypoint AND a CMD (https://stackoverflow.com/questions/21553353/what-is-the-difference-between-cmd-and-entrypoint-in-a-dockerfile) – Bguess May 10 '22 at 08:00