Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow --entrypoint to be set to null in a docker run or docker create #23498

Closed
programmerq opened this issue Jun 13, 2016 · 5 comments · Fixed by #23718
Closed

Allow --entrypoint to be set to null in a docker run or docker create #23498

programmerq opened this issue Jun 13, 2016 · 5 comments · Fixed by #23718
Labels
area/runtime kind/feature Functionality or other elements that the project doesn't currently have. Features are new and shiny

Comments

@programmerq
Copy link
Contributor

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:

foo

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.

@programmerq programmerq added the kind/feature Functionality or other elements that the project doesn't currently have. Features are new and shiny label Jun 13, 2016
@mountkin
Copy link
Contributor

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

@programmerq
Copy link
Contributor Author

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" notifications@github.com 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
#23498 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AACRnuHYnJydqWbZbVezdavvgV-VZHXkks5qLeOIgaJpZM4I0tri
.

@yongtang
Copy link
Member

@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.

yongtang added a commit to yongtang/docker that referenced this issue Aug 5, 2016
This fix tries to address the issue raised in moby#23498 to allow unset
`--entrypoint` in `docker run` or `docker create`.

This fix checks the flag `--entrypoint` and, in case `--entrypoint=` (`""`)
is passed, unset the Entrypoint during the container run.

Additional integration tests have been created to cover changes in this fix.

This fix fixes moby#23498.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
resouer pushed a commit to resouer/docker that referenced this issue Oct 24, 2016
This fix tries to address the issue raised in moby#23498 to allow unset
`--entrypoint` in `docker run` or `docker create`.

This fix checks the flag `--entrypoint` and, in case `--entrypoint=` (`""`)
is passed, unset the Entrypoint during the container run.

Additional integration tests have been created to cover changes in this fix.

This fix fixes moby#23498.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
@marcodelapierre
Copy link

As regards the entrypoint... should we just ensure that it's unset, and then do everything through the run argument? At this point :

$ podman run -it --rm --entrypoint '' --env-file /home/ubuntu/singularity-hpc/modules/python/3.9.2-slim/99-shpc.sh -v /data docker.io/library/python:3.9.2-slim echo ciao
ciao

The main drawback is that there's no choice over which shell is used

Will keep looking for other ways

@thaJeztah
Copy link
Member

most images only have a CMD set, no separate ENTRYPOINT, so you won't have to override it, but you can docker inspect the image to know what it has configured;

docker inspect --format '{{json .Config}}' docker.io/library/python:3.9.2-slim | jq .
{
  "Hostname": "",
  "Domainname": "",
  "User": "",
  "AttachStdin": false,
  "AttachStdout": false,
  "AttachStderr": false,
  "Tty": false,
  "OpenStdin": false,
  "StdinOnce": false,
  "Env": [
    "PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
    "LANG=C.UTF-8",
    "GPG_KEY=E3FF2839C048B25C084DEBE9B26995E310250568",
    "PYTHON_VERSION=3.9.2",
    "PYTHON_PIP_VERSION=21.0.1",
    "PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/b60e2320d9e8d02348525bd74e871e466afdf77c/get-pip.py",
    "PYTHON_GET_PIP_SHA256=c3b81e5d06371e135fb3156dc7d8fd6270735088428c4a9a5ec1f342e2024565"
  ],
  "Cmd": [
    "python3"
  ],
  "Image": "sha256:09147162b3f325a1bdc0df946f3ac8ed04e7690c7d17a754f88fc640cd1a23d4",
  "Volumes": null,
  "WorkingDir": "",
  "Entrypoint": null,
  "OnBuild": null,
  "Labels": null
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/runtime kind/feature Functionality or other elements that the project doesn't currently have. Features are new and shiny
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants