hashicorp / packer-plugin-docker

Packer plugin for Docker Builder
https://www.packer.io/docs/builders/docker
Mozilla Public License 2.0
31 stars 25 forks source link

Docker builder documentation is incorrect (fix_upload_owner) #64

Open hc-github-team-packer opened 2 years ago

hc-github-team-packer commented 2 years ago

This issue was originally opened by @boblechat in https://github.com/hashicorp/packer/issues/11187 and has been migrated to this repository. The original issue description is below.


Overview of the Issue

Building a docker image from a base image running with a non root user always causes a "Permission denied" in shell provisioners. Documentation clearly states that the fix_upload_owner is set to true by defaut, which is incorrect. You have to set it explicitely! Also, could you clarify what "the owner will depend on the version of docker installed in the system" means? That's gibbersih to me.

Reproduction Steps

To make it fail:

To make it work;

Packer version

1.7.4

Simplified Packer Buildfile

gist is here

Operating system and Environment details

Irrelevant here

Log Fragments and crash.log files

When it fails:

==> agent.docker.alm: Using docker communicator to connect: 172.17.0.2
==> agent.docker.alm: Provisioning with shell script: C:\Users\me\AppData\Local\Temp\packer-shell381356875
==> agent.docker.alm: sh: 1: /tmp/script_120.sh: Permission denied
==> agent.docker.alm: Provisioning step had errors: Running the cleanup provisioner, if present...

When it works:

==> agent.docker.alm: Using docker communicator to connect: 172.17.0.2
==> agent.docker.alm: Provisioning with shell script: C:\Users\me\AppData\Local\Temp\packer-shell892913999
    agent.docker.alm: Hello from Hell!
==> agent.docker.alm: Committing the container