hashicorp / packer-plugin-docker

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

Packer docker builder does not reset ENTRYPOINT properly #13

Closed ghost closed 8 months ago

ghost commented 3 years ago

This issue was originally opened by @bertramn as hashicorp/packer#7487. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


We are using packer to build a container with a parent that includes an entrypoint. In the packer build we "reset" entrypoint with ENTRYPOINT []. Unfortunately the container is being committed with the entrypoint of the parent still in place.

Doing this in a Dockerfile gets rid of the entrypoint from parent:

FROM ep-issue:parent
ENTRYPOINT []
CMD []

While the same in packer version does not:

{
  "builders": [
    {
      "type": "docker",
      "image": "ep-issue:parent",
      "pull": "false",
      "commit": "true",
      "changes": [
        "ENTRYPOINT []",
        "CMD []"
      ]
    }
  ],
  "post-processors": [
    {
      "type": "docker-tag",
      "repository": "ep-issue",
      "tag": "child2"
    }
  ]
}
dimisjim commented 3 years ago

Hey maintainers

Can this https://github.com/hashicorp/packer/issues/7487#issuecomment-489430007 be the default behavior?

i.e not having to explicitly set ENTRYPOINT and CMD to an empty array. These should be null by default, if not set