Docker starts in exited status

Time:2022-5-5

The status is always exited after docker run

resolvent:

Add parameter: – it


docker run -it -d -p 80 -name static_web cjk1/benn

-d: Run the container in the background and return the container ID;

-i: Run the container in interactive mode, usually at the same time as – t;

-t: Reassign a pseudo input terminal to the container, which is usually used together with – I;

Supplement: docker restart exited process command

When the server restarts, many containers of docker hang up


docker restart $(docker ps -a -q)

Docker PS view

The above is my personal experience. I hope I can give you a reference, and I hope you can support developpaer. If there are mistakes or not fully considered, please don’t hesitate to comment.