简体   繁体   中英

How to disown a docker container running inside SSH session

I have accessed a Remote Machine (call it , RM) through SSH (from my host). And I am running a docker image inside RM via my SSH session. Both are Ubuntu 16.04 based.

There are some processes running inside this docker container, so I can't exit the container.

So,how do I detach this ssh session from my host, so that those processes inside the docker would still run unaffected.

I am doing this, because I have to restart my host machine for some purpose.

PS: In this link Correct way to detach from a container without stopping it , it's not running the docker container via SSH session. So two scenarios are different.

First, you have to start your Docker container in daemon (non-interactive) mode, using -d argument and dropping -it . Don't forget to name your container for further usage with --name foo option.

After container is started, you can control it using docker exec -it foo sh-or-whatever . If your ssh session will terminate, container will continue running. However, you docker exec session will be over.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM