Why docker exited just after starting up
Reason for exit
1. docker container There must be a foreground process to run. If no foreground process is executed, the container will think it is idle and will exit on its own
2. If the commands run by the container are not those that have been suspended (running top, tail, loop, etc.) , it will automatically exit
3. This is a mechanism problem of docker
Solution:
docker run -dit docker.elastic.co/elasticsearch/elasticsearch:5.6.16 /bin/bash
Add -it parameter to run interactively
Add the -d parameter to run in the background
This way you can start a docker container that stays running in the background.
For more related tutorials, please pay attention to the docker tutorial column on the PHP Chinese website.
The above is the detailed content of Why does docker exit as soon as it starts?. For more information, please follow other related articles on the PHP Chinese website!