Expecting
Here is my packer file:
{
"builders" : [
{
"type": "docker",
"image": "nginx",
"commit": "true"
}
],
"provisioners" : [
{
"type": "file",
"source": "./index.html",
"destination": "/usr/share/nginx/html/index.html"
}
],
"post-processors" : [
{
"type": "docker-tag",
"repository": "repo",
"tag": "latest"
}
]
}
After packer build for above file when running the docker container out of the above outputted artifact i.e. custom nginx docker image with command docker run -it -d -p 8080:80 --name web repo, observed that the docker container comes up, port is occupied but nginx process isn't running inside the docker container due to which html content is not accessible on the specified port.
URL: http://localhost:8080
However, the above scenario of creating custom nginx docker image and running docker container for the same is performed using below Dockerfile with docker commands it works fine i.e. docker container comes up, port is occupied and also HTML content is accessible:
Here is the Dockerfile:
FROM nginx:latest
COPY ./index.html /usr/share/nginx/html/index.html
I need to use packer docker builder, what can be the possible problem? Are there any limitations on usage of docker builder with packer or with nginx?
question from:
https://stackoverflow.com/questions/66064621/packer-docker-builder-with-nginx-as-base-image 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…