I suppose a docker container run at background could be held alive. But the truth is container always exists immediately in detached mode.
docker run -d busybox
ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
42d4db933e8a busybox:latest /bin/sh 11 seconds ago Exited (0) 11 seconds ago sharp_sammet
How to persist this session without faking doing some loop jobs to prevent being closed.
Just simply run docker run -dt busybox
instead.
The option "t" means tty(stdio/stdout) will be held and thing works as you expected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With