I have some containers running and once in a while the connection is lost in the terminal. The container is still running perfectly. How do I reconnect to the samme user process?
The problem is:
When I do docker exec -it name bash
, I get a new root user. But then I need to stop the applications the original user started to get them into this bash.
How do you reconnect to the original running user process/bash.
info: using mac terminal.
You would need to use the docker attach <container ID>
refer: man docker-attach
"
The docker attach command allows you to attach to a running container using the container's ID or name, either to view its ongoing output or to control it interactively. You can attach to the same contained process multiple times simultaneously, screen sharing style, or quickly view the progress of your daemonized process.
You can detach from the container (and leave it running) with CTRL-p CTRL-q (for a quiet exit) or CTRL-c which will send a SIGKILL to the container. When you are attached to a con‐ tainer, and exit its main process, the process's exit code will be returned to the client.
"
docker ps -a # list all the containers and find your containder
docker start <container ID> # start the exited container
docker attach <container ID> # attach to your container
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