Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (2.3k points)

So I've been trying to run a process from inside a container, but every time I exit the container using the exit command it stops the process I was trying to execute.

What is the standard way to detach from a container while keeping the process running and checking on it once in a while to make some changes?

1 Answer

0 votes
by (6.9k points)

There is a very easy way to do this.

To detach from the container's shell without stopping a process you just need to use 

Ctrl + p & then Ctrl + q

NOTE :

  • When using "$ docker run -t -i"  One can detach using ^P^Q and then reattach using docker attach command.
  • When using "$ docker run -i"  One cannot detach using ^P^Q as it will disrupt stdin
  • When using "$ docker run "  One cannot detach using ^P^Q and then reattach using docker attach command but it can SIGKILL the client.
Hope this helped :)

Learn more through docker training course as industry professionals give you deep insights for working with docker.

Browse Categories

...