I'm trying to override the docker entrypoint using docker run. This works in docker-compose:
myapp:
build: .
security_opt:
- seccomp:unconfined
entrypoint: dlv debug local/myorg/myapp -l 0.0.0.0:2345 --headless=true --log=true --server
volumes:
Using:
docker run --entrypoint "dlv debug local/myorg/myapp -l 0.0.0.0:2345 --headless=true --log=true --server"
Results in:
exec: \"dlv debug local/myorg/myapp -l 0.0.0.0:2345 --headless=true --log=true --se
rver\": stat dlv debug local/myorg/myapp -l 0.0.0.0:2345 --headless=true --log=true --server: no such file or directory
Check the article "How to properly override the ENTRYPOINT using docker run" by Adrian Oprea.
The documentation clearly states that the ENTRYPOINT only specifies the executable to run, when the container starts.
There is something a bit counter-intuitive here and if you take a good look at the example commands on the documentation page, you’ll see that the arguments are being passed after the image name.
In your case:
docker run --entrypoint dlv YOUR_IMAGE_NAME debug local/myorg/myapp -l 0.0.0.0:2345 --headless=true --log=true --server
^^^^^^^^^^^^^^^
Extending @VonC's answer in a bit simpler way, I had to override my ENTRYPOINT
with npm start
because I mistakenly wrote ENTRYPOINT ["ng","serve"]
at the end and it was throwing error
docker: Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: "ng": executable file not found in $PATH: unknown.
That clearly meant that ng
was not added to $PATH
environment variable.
So I had to override my ENTRYPOINT
instruction to ENTRYPOINT ["npm","start"]
and due to that space in between npm
and start
I wasn't able to run it easily
So as suggested by @VonC's answer, you can pass arguments after the image name like
docker run -p 4200:4200 --entrypoint npm ihamzakhanzada/angular-app:1.1 start
Where ihamzakhanzada/angular-app:1.1
is the name of the image.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With