How to properly override the ENTRYPOINT using docker run

kyohei itoDocker-4

Originally published on https://oprea.rocks/blog/how-to-properly-override-the-entrypoint-using-docker-run/

The ENTRYPOINT of an image is similar to a COMMAND because it specifies what executable to run when the container starts, but it is (purposely) more difficult to override

docker run --entrypoint "/bin/ls -al /root" debian
container_linux.go:247: starting container process caused "exec: \"/usr/bin/ls -al\": stat /usr/bin/ls -al: no such file or directory"
docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \"/usr/bin/ls -al\": stat /usr/bin/ls -al: no such file or directory".
ERRO[0001] error getting events from daemon: net/http: request canceled
docker run -it --entrypoint /usr/bin/redis-cli example/redis --help
docker run --entrypoint "/bin/ls" debian -al /root

Photo credits: kyohei itoDocker-4

--

--

Founder & CEO of WeRemote.EU. Remote work enthusiast. Bookworm.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store