-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Packer 1.4.0 builds Ubuntu Docker image that cannot run /bin/bash, /bin/sh #7578
Comments
I was able to reproduce a very similar symptom with version 1.3.5 if I use a shell other than bash (I picked the official Alpine image). Specifically, using the following line in the docker builder:
...and the following in the inline shell provisioner:
Then, after building like before:
If I switch to a base container with bash installed ( I thought this might be relevant as I seem to recall seeing some discussion about how 1.4.0 defaults to |
We did change it for the 1.4.0 release: 2718a5e |
if I use a run_command of ["-d", "-i", "-t", "{{.Image}}", "/bin/sh"] it seems to work fine. I'm not an expert on how docker reads entrypoints so I'm going to need to do a docs dive on this one. |
Hello there, recently the default entrypoint has changed for docker images, it's now ❯ /bin/sh /bin/sh
/bin/sh: /bin/sh: cannot execute binary file You can run sh or bash by running ❯ docker run -it --rm my-test-repository:my-test-tag -c "/bin/sh"
# ls
bin dev home lib64 mnt packer-files root sbin sys tmp var
boot etc lib media opt proc run srv test-file usr
# exit
❯ docker run -it --rm my-test-repository:my-test-tag -c "/bin/bash"
root@2209dffa207c:/# ls
bin dev home lib64 mnt packer-files root sbin sys tmp var
boot etc lib media opt proc run srv test-file usr
root@2209dffa207c:/# exit Another way to run bash could be to just pass the entrypoint: ❯ docker run -it --rm --entrypoint=/bin/bash my-test-repository:my-test-tag
root@ab767ff84d6d:/# ls
bin dev home lib64 mnt packer-files root sbin sys tmp var
boot etc lib media opt proc run srv test-file usr
root@ab767ff84d6d:/# exit The simplest form is to run sh: ❯ docker run -it --rm my-test-repository:my-test-tag
# ls
bin dev home lib64 mnt packer-files root sbin sys tmp var
boot etc lib media opt proc run srv test-file usr
# exit |
One thing we could do here would be to change the default entrypoint from What do you think @rickard-von-essen, @SwampDragons ? |
Ah,
|
@azr I think we should add some documentation about this and then close, what do you think? |
there it is ! |
I'm not sure if this is relevant but it seems now packer is changing the entrypoint from the parent images to just "/bin/sh" in my opinion this is a huge step backwards/bug. |
Hey @rlees85, because the docker builder uses command lines, the entrypoint is defaulted to what entrypoint was used in the command line. It used to be You can follow the instructions in this comment to fix it ! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Note that this problem doesn't happen when I use Packer version 1.3.5 following the exact same steps (as far as I can tell - I did double-check).
Use the minimal template below and run the following with packer version 1.4.0:
Then, try to run
/bin/bash
or/bin/sh
with a container from the resulting image - both fail:Rerun the same packer command with version 1.3.5. Then, bash works:
Requested details
Packer version: 1.4.0
Host platform: LinuxMint x64:
Debug log output: https://gist.github.com/njgraham/216761a042988abade4dc22a3cd13978
Simple packer template used in the above examples:
The text was updated successfully, but these errors were encountered: