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.
==> 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
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;
fix_upload_owner = true
in agent.pkr.hclPacker 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:
When it works: