Comments (14)
any update on this?
it's a very fundamental feature that this plugin lacks
from packer-plugin-docker.
I've run into this issue and it's super unexpected. packer should definitely not clobber CMD/ENTRYPOINT if it's not defined in the packer script.
from packer-plugin-docker.
I mean that was my "workaround" too -- setting ENTRYPOINT everywhere back to some 'default'. This is not a solution.
from packer-plugin-docker.
Any update on this issue? I am facing the same problem. The official doc doesn't explain the current behavior.
from packer-plugin-docker.
Our development team is facing the same problem. Hope a fix can be made :)
from packer-plugin-docker.
To be more precise :
Here is the definition of the 'Cmd' and 'Entrypoint' fields on a base image pulled from DockerHub :
# docker inspect debian:bullseye-slim -f '{{ .ContainerConfig.Cmd }}
[/bin/sh -c #(nop) CMD ["bash"]]
# docker inspect debian:bullseye-slim -f '{{ .ContainerConfig.Entrypoint }}
[]
When we build an image derived from this Debian base image with Packer, even if we only add a LABEL, the 'Cmd' and 'Entrypoint' fields are modified, which is not the case when using a Dockerfile :
# docker inspect <our_image> -f '{{ .ContainerConfig.Cmd }}
[]
# docker inspect <our_image> -f '{{ .ContainerConfig.Entrypoint }}
[/bin/sh]
Note : Extract from the Packer's template, which is very simple :
source "docker" "debian-bullseye" {
image = 'debian:bullseye-slim'
commit = true
changes = [
"LABEL env=devel"
]
}
from packer-plugin-docker.
It seems that this problem can't be solved easily. The behavior comes from the way the Docker builder works : it is derived from the docker commit
command, and Packer run the container with run_command
which define the entrypoint to /bin/sh :
["-d", "-i", "-t", "--entrypoint=/bin/sh", "--", "{{.Image}}"]
That's the reason why the CMD and ENTRYPOINT are changed.
The Docker builder is a beautiful plugin but, unfortunately, not very usable.
from packer-plugin-docker.
Hi,
Maybe we can imagine a simple solution like this :
when a Docker image is build and do not define CMD
nor ENTRYPOINT
values, the Docker Plugin get this parameters from the base image (defined in the source.docker
block) and automatically add them into the "changes" array, so that they would be taken into account by the docker commit --change
command.
What do you think about it ?
Thanks.
from packer-plugin-docker.
Any effective workarounds?
from packer-plugin-docker.
yeah, just use another container builder
from packer-plugin-docker.
@dimisjim suggestions?
from packer-plugin-docker.
https://github.com/docker/buildx
from packer-plugin-docker.
I think I figured out a workaround.
Instead of leaving ENTRYPOINT blank, I set ENTRYPOINT to a command that is effectively equivalent to nothing but that Packer won't clobber:
"ENTRYPOINT [\"/bin/sh\", \"-c\", \"exec \\\"$0\\\" \\\"$@\\\"\"]",
Ugly but seems to work.
from packer-plugin-docker.
@josh-m-sharpe you're right, it's not a solution. It's a workaround lol
from packer-plugin-docker.
Related Issues (20)
- Parallel Docker pushes still failing due to credentials being removed HOT 3
- Unable to push to ECR private repo in 1.0.7 HOT 5
- ECR Login fails in Packer 1.8.3 HOT 5
- No meaningful error even in debug mode when Docker Desktop (WSL2) is not running HOT 2
- /bin/sh: 1: /home/ubuntu/packer/script_2501.sh: Permission denied
- Unable to push an image to ECR HOT 6
- simple docker build changing CMD and ENTRYPOINT of resulting image HOT 2
- Packer should remove /packer-files mount point
- PowerShell at Windows container ignores errors
- Building images in parallel and pushing them to Docker Hub results in premature logout HOT 1
- docker-push doesn't push to Private repository. HOT 4
- HCL2 example of "windows_container": true uses ubuntu image HOT 2
- Packer's docker plugin metadata change for Env does require equal sign and cannot extend env vars in hcl2 variant language
- Packer docker builder reseting ENTRYPOINT and CMD
- error with provisioning scripts in docker HOT 4
- Question template in the issue is out of date HOT 1
- Docker-push post processer ecr_login assume role support
- Packer 1.12.0-alpha1 testing
- Packer hangs on "Provisioning with shell script" when provisioning sysbox image HOT 1
- Support `--platform` docker CLI argument to target the image architecture to be produced. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from packer-plugin-docker.