You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
From PowerShell on Windows, I'm trying to use docker import to create a new image from a tarball, and I'm using its --change command line option to set the ENTRYPOINT of the newly created image. I would like the newly created image to use an execENTRYPOINT and I think that I'm specifying that, but when the image is created, it is for some reason using a shellENTRYPOINT
The root cause is that PowerShell's rules for escaping command line characters on Windows are particularly complicated to understand, and it would be nice if an execENTRYPOINT could be specified with ' as well as the existing ". By allowing ' it would make it easier for Windows PowerShell users to craft command lines.
Steps to reproduce the issue:
Create a tarball, then import it. In these minimal repro steps the tarball isn't a valid image for a container that can start, but these steps are sufficient to demonstrate the issue, and the bug also happens for real images (feel free to use a different tarball if you have one to hand).
docker inspect the image that you just created (docker import outputs to stdout the sha256 hash that you need to use), for example on my machine it was docker inspect sha256:d07c694f5b035edd8c87df2a6c0087a4ca866f8b0958b1d6edcedeaae44bac4b (yours will be different because the modified date of the file will be different)
Describe the results you received: docker inspect will output a lot of JSON and ENTRYPOINT is mentioned twice; ignore the mention in ContainerConfig because it isn't relevant for us, and instead look at the mention in Config which is:
Describe the results you expected:
The results that I received above demonstrate that, even though the command line switch specified an execENTRYPOINT, it has been incorrectly specified as a shellENTRYPOINT in the image that was created.
Instead of the above, I expected the JSON to contain:
"Entrypoint": [
"cat",
"world.txt"
],
If instead I replace step 3 above with docker import --change 'ENTRYPOINT [""""cat"""", """"world.txt""""]' tarball.tar then it works, but it's not easy to understand that I need to craft a command line like that, so it'd be good if Docker could provide more help either via documentation or allowing more flexibility to ENTRYPOINT.
Output of docker version:
Client: Docker Engine - Community
Version: 18.09.2
API version: 1.39
Go version: go1.10.8
Git commit: 6247962
Built: Sun Feb 10 04:12:31 2019
OS/Arch: windows/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.2
API version: 1.39 (minimum version 1.12)
Go version: go1.10.6
Git commit: 6247962
Built: Sun Feb 10 04:13:06 2019
OS/Arch: linux/amd64
Experimental: false
DavidSimner
changed the title
docker import doesn't support exec entrypoint
docker import doesn't support exec entrypoint easily for Windows PowerShell users
Feb 22, 2019
I step into a similar situation on s390x, and found that the single and dounle quote mark on the change command makes quite a difference here, with " the entrypoint would be called by /bin/sh
Description
From PowerShell on Windows, I'm trying to use
docker import
to create a new image from a tarball, and I'm using its--change
command line option to set theENTRYPOINT
of the newly created image. I would like the newly created image to use an execENTRYPOINT
and I think that I'm specifying that, but when the image is created, it is for some reason using a shellENTRYPOINT
The root cause is that PowerShell's rules for escaping command line characters on Windows are particularly complicated to understand, and it would be nice if an exec
ENTRYPOINT
could be specified with'
as well as the existing"
. By allowing'
it would make it easier for Windows PowerShell users to craft command lines.Steps to reproduce the issue:
Create a tarball, then import it. In these minimal repro steps the tarball isn't a valid image for a container that can start, but these steps are sufficient to demonstrate the issue, and the bug also happens for real images (feel free to use a different tarball if you have one to hand).
echo Hello >world.txt
tar -cf tarball.tar world.txt
docker import --change "ENTRYPOINT [""cat"", ""world.txt""]" tarball.tar
docker inspect
the image that you just created (docker import outputs to stdout the sha256 hash that you need to use), for example on my machine it wasdocker inspect sha256:d07c694f5b035edd8c87df2a6c0087a4ca866f8b0958b1d6edcedeaae44bac4b
(yours will be different because the modified date of the file will be different)Describe the results you received:
docker inspect
will output a lot of JSON andENTRYPOINT
is mentioned twice; ignore the mention inContainerConfig
because it isn't relevant for us, and instead look at the mention inConfig
which is:Describe the results you expected:
The results that I received above demonstrate that, even though the command line switch specified an exec
ENTRYPOINT
, it has been incorrectly specified as a shellENTRYPOINT
in the image that was created.Instead of the above, I expected the JSON to contain:
If instead I replace step 3 above with
docker import --change 'ENTRYPOINT [""""cat"""", """"world.txt""""]' tarball.tar
then it works, but it's not easy to understand that I need to craft a command line like that, so it'd be good if Docker could provide more help either via documentation or allowing more flexibility toENTRYPOINT
.Output of
docker version
:Output of
docker info
:Additional environment details (AWS, VirtualBox, physical, etc.):
Physical laptop
The text was updated successfully, but these errors were encountered: