For example, I use
docker hubThe Debian official image of creates a container, then enters the container update, then deploys a nginx service, sets the self-start in rc.local, then exits the container and returns the container
commitA new image a was created. After that, I tried to start a container from image A but found that the startup failed.
docker run -dAfter
docker psThere is no such container in the container.
docker run -itAfter exiting the container, the container is closed. What is the reason? Please answer, thank you.
Dockerfile is not yet in good hands.
A container needs a service to run, and the official recommendation is to run only one service per container.
All Dockerfile have CMD or ENTRYPOINT after them. If you want to run your image in the background, run -d is followed by a command or program that can last.