Moby: Allow `--entrypoint` to be set to `null` in a `docker run` or `docker create`

Created on 13 Jun 2016  ·  3Comments  ·  Source: moby/moby

I would like to be able to "unset" an ENTRYPOINT at the command line when creating a container.

Using this Dockerfile and entrypoint.sh as an example:

Dockerfile:

FROM alpine
ADD entrypoint.sh /entrypoint.sh
RUN chmod 755 /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD echo foobar

entrypoint:

#!/bin/sh
echo "I am an entrypoint"
exec "$@"

If I wanted to unset the entrypoint, I would like to be able to run this: docker run --entrypoint='' --rm -it image echo foo

I would expect this to produce the following output:


but it does the following instead:

I am an entrypoint
foo

Providing some way for docker run or docker create to force the ENTRYPOINT to be null without having to create another image would be great.

areruntime kinfeature

Most helpful comment

@programmerq I created a pull request #23718 to address this issue. If --entrypoint= (with empty string "") is passed then docker run or docker create will unset the entrypoint and rely on the default behavior.

Please let me know if there are any issues.

All 3 comments

Try this
docker run --entrypoint=/bin/echo --rm image foo

I'm aware that this and other workarounds exist, but that doesn't mean that
this issue couldn't or shouldn't be addressed.
On Jun 13, 2016 5:11 PM, "Shijiang Wei" [email protected] wrote:

Try this
docker run --entrypoint=/bin/echo --rm image foo


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/docker/docker/issues/23498#issuecomment-225735177,
or mute the thread
https://github.com/notifications/unsubscribe/AACRnuHYnJydqWbZbVezdavvgV-VZHXkks5qLeOIgaJpZM4I0tri
.

@programmerq I created a pull request #23718 to address this issue. If --entrypoint= (with empty string "") is passed then docker run or docker create will unset the entrypoint and rely on the default behavior.

Please let me know if there are any issues.

Was this page helpful?
0 / 5 - 0 ratings