Let me ask you a question. I ran a container.
helloTo map the host port and container port through the -p parameter.
sudo docker run -d --name hello -p 8080:8080 -m 268435456 ubuntu:14.04 bin/bash -c "while true; do echo hello $(date); sleep 2; done"
Then a new image is generated by the commit command
sudo docker commit hello hello-image.
Then, based on the image, use the
docker run -d hello-imageRerun a new container (the -p parameter is not specified at this time).
The newly generated container has no port mapping, and also has no -m parameter information previously set by the container.
My question is: How do you understand that the newly generated container does not have two pieces of information: mapped ports and memory limits? What parameters belong to the container and what parameters belong to the mirror image?
Port mapping belongs to container and does not exist in image. it should be specified every time run.