docker Container is not running

Reference Links: https://stackoverflow.com/questions/29599632/docker-container-is-not-running/49204476

1、

Container 79b3fa70b51d seems to only do an echo.

That means it starts, echo and then exits immediately.

The next docker exec command wouldn't find it running in order to attach itself to that container and execute any command: it is too late. The container has already exited.

The docker exec command runs a new command in a running container.

The command started using docker exec will only run while the container's primary process (PID 1) is running

2、

RUN -d -v Docker / App: / var / WWW / swoft --name swoft swoft / swoft // development environment and associated container 
Docker RUN -d --entrypoint = "" -v / App: / var / WWW / --name swoft swoft swoft / swoft bash // development environment and associated container
docker ps -a
docker exec -it swoft bash 

 

3, reference links: https://segmentfault.com/a/1190000010940432

 

1. The life cycle of the container. Docer container should be seen as a separate process and operating environment. Container is not equivalent to a virtual operating system. Docker developers have been advocated doder container should only run a process. For example, a web server service is a process. docker run command is to run a process. When a process is over, then the docker container will be over.

2. A description of the phenomenon in question, the difference in the two commands on whether to add at the end of /bin/bashthis command. First stop for the time being. Docker image is how we look back generated.

3.Dockerfile file. Dockerfile file has two keywords CMDand ENTRYPOINT. Wherein CMDthe values can be overridden to. For chestnut:
the content of assumptions Dockerfile includes:

FROM python
CMD ["/home/hello.sh","Hello World"] ENTRYPOINT ["/home/hello.sh","xiaoming"]

The feature can then be covered CMD view, if docker runthe increased /bin/bash. So, when the mirror run, CMD executed becomes /bin/bash. General image file keywords selected one of two on it. But it can also be used simultaneously. At the same time when in use, the value of CMD will be treated as a parameter ENTRYPOINT. So, ENTRYPOINT content becomes ["/home/hello.sh","/bin/bash"].

4. We look at the mirror I want to start a registry which are included in the CMD and ENTRYPOINT. As shown below:
image description

According to the figure above shows the first two lines, running after the container is the default execution of /entrypoint.shthe script, the script command parameters are /etc/docker/regis.... So, if we add their own new command at run time, then mirrored built-in command execution can not be carried out correctly, so it is Exited the container.

Guess you like

Origin www.cnblogs.com/cbugs/p/12215481.html