Answer the question
In order to leave comments, you need to log in
For what reason can the container in docker not start?
I installed the ubuntu server, as well as the docker, then with the command sudo docker run -d ubuntu installed the container. Now I enter the command sudo docker ps and in response I get only this line
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Answer the question
In order to leave comments, you need to log in
The container starts and immediately closes.
Because by default, the command is executed there /bin/bash
, which, without a terminal, immediately ends execution.
You run the container in daemon mode (key -d
)
If there were not bash
some long-running command, mysqld or nginx, everything would work longer.
Probably, you need to start the container and "be" in its shell:
docker run -it --rm ubuntu
-i
interactive mode-t
connects a virtual terminal--rm
will delete the container as soon as you exit itdocker run -d ubuntu tail -f /dev/null
- here is a dummy command that will run indefinitely; docker run -t -d ubuntu
- a virtual terminal is connected here and bash will not crash, but will remain running.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question