Packer: Docker entrypoint behaviour is not documented

Created on 17 Sep 2019  ยท  4Comments  ยท  Source: hashicorp/packer

Using the following Docker builder:

  "builders": [
    {
      "name": "docker",
      "type": "docker",
      "image": "alpine",
      "commit": true,
      "run_command": ["-d", "-i", "-t", "--", "{{.Image}}", "/bin/sh"],
      "changes": [
        "ENTRYPOINT ['/opt/entrypoint.sh']"
      ]
    }
  ]

Will build Docker images with the following entrypoint:

            "Entrypoint": [
                "/bin/sh",
                "-c",
                "/opt/entrypoint.sh"
            ],

This is unintuitive to most users and the following exec style should be documented in Packer:

"changes": ["ENTRYPOINT [\"/opt/entrypoint.sh\"]"]
bug buildedocker docs

Most helpful comment

I have updated the code snippet. If you use the exec format it still doesn't work properly unless you use and escape double quotes.

I am just asking for it to be documented.

All 4 comments

No that's working correctly. You are using the shell form, but you expect the result from the exec form*)

$ cat  issue-8117.json | jq ".builders[].changes"
[
  "ENV ENV=/etc/profile",
  "ENTRYPOINT [ \"/opt/entrypoint.sh\" ]"
]

$ docker inspect --format "{{ .Config.Entrypoint }}" sha256:327d061ee2d4a6375426a9d0684e464b564b5b5ea8e6ed1b0a33d276e5a1599e
[/opt/entrypoint.sh]

*) https://docs.docker.com/engine/reference/builder/#entrypoint

(EDIT: I see that you updated your OP to include this)

I have updated the code snippet. If you use the exec format it still doesn't work properly unless you use and escape double quotes.

I am just asking for it to be documented.

this was closed by #8240 :)

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shashanksinha89 picture shashanksinha89  ยท  3Comments

paulcdejean picture paulcdejean  ยท  3Comments

Tensho picture Tensho  ยท  3Comments

mwhooker picture mwhooker  ยท  3Comments

jesse-c picture jesse-c  ยท  3Comments