Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

simple docker build changing CMD and ENTRYPOINT of resulting image #132

Closed
josh-m-sharpe opened this issue Nov 18, 2022 · 2 comments 路 Fixed by #167
Closed

simple docker build changing CMD and ENTRYPOINT of resulting image #132

josh-m-sharpe opened this issue Nov 18, 2022 · 2 comments 路 Fixed by #167

Comments

@josh-m-sharpe
Copy link

josh-m-sharpe commented Nov 18, 2022

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Overview of the Issue

the resulting image packer produces is changing the CMD and Entrypoint (possibly other things)

build {
  name = "amzn2-ctm-core"

  source "source.docker.dockerhub" {
    image  = "amazonlinux:2"
  }

  post-processors {
    post-processor "docker-tag" {
      tags = [
        "core_${local.timestamp}",
        "core_latest"
      ]
    }
  }
}

After building this, comparing the images:

# The source image:
$ docker inspect amazonlinux:2 | jq -s ".[0][0].Config.Cmd"
[
  "/bin/bash"
]
$ docker inspect amazonlinux:2 | jq -s ".[0][0].Config.Entrypoint"
null

# the resulting image
$ docker inspect acct1234.dkr.ecr.us-east-1.amazonaws.com/amzn2-ctm:core_20221118194409 | jq -s ".[0][0].Config.Cmd"
null
$ docker inspect acct1234.dkr.ecr.us-east-1.amazonaws.com/amzn2-ctm:core_20221118194409 | jq -s ".[0][0].Config.Entrypoint"
[
  "/bin/sh"
]

Why is packer doing this?

Packer version

1.8.4

Operating system and Environment details

built on, and sourcing from:
amazonlinux;2

@github-actions github-actions bot removed the bug label Nov 18, 2022
@josh-m-sharpe
Copy link
Author

Here's another similar example:

build {
  name = "amzn2-ctm-core"

  source "source.docker.dockerhub" {
    image  = "amazonlinux:2"
    changes = [
      "ENTRYPOINT [\"/bin/bash\", \"-l\", \"-c\"]",
      "CMD /bin/bash"
    ]
  }

  post-processors {
    post-processor "docker-tag" {
      tags = [
        "core_${local.timestamp}",
        "core_latest"
      ]
    }
  }
}

Results in docker inspect with this:

            "Cmd": [
                "/bin/sh",
                "-c",
                "/bin/bash"
            ],
            "Entrypoint": [
                "/bin/bash",
                "-l",
                "-c"
            ],

This is very unexpected.

@nywilken nywilken transferred this issue from hashicorp/packer Dec 16, 2022
@huyz
Copy link
Contributor

huyz commented Feb 1, 2023

Yes this breaks Dockerfile images with esoteric errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants