Home > Operation and Maintenance > Docker > Why does docker exit as soon as it starts?

Why does docker exit as soon as it starts?

angryTom
Release: 2020-03-21 17:28:41
Original
4128 people have browsed it

Why does docker exit as soon as it starts?

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template