hashicorp / hashicorp/packer-plugin-docker

Docker builder documentation is incorrect (fix_upload_owner)

Open
#64 0 comments 0 reactions 0 assignees View on GitHub
docs good first issue help wanted track-internal
Dominant language
Go
Stars
40
Forks
29
PR merge metrics
No merged PRs in 30d

Description

_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](https://www.packer.io/docs/builders/docker#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:
- packer build [base.pkr.hcl](https://gist.github.com/boblechat/d667a3e2f5f227162aa31bd323de3b09#file-base-pkr-hcl)
- packer build [agent.pkr.hcl](https://gist.github.com/boblechat/d667a3e2f5f227162aa31bd323de3b09#file-agent-pkr-hcl)

To make it work;
- packer build [base.pkr.hcl](https://gist.github.com/boblechat/d667a3e2f5f227162aa31bd323de3b09#file-base-pkr-hcl)
- uncomment `fix_upload_owner = true` in agent.pkr.hcl
- packer build [agent.pkr.hcl](https://gist.github.com/boblechat/d667a3e2f5f227162aa31bd323de3b09#file-agent-pkr-hcl)

### Packer version

1.7.4

### Simplified Packer Buildfile

gist is [here](https://gist.github.com/boblechat/d667a3e2f5f227162aa31bd323de3b09)

### 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
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.