Adam
Adam

Reputation: 4172

Check process of detached Docker exec command

I have a python script that loads my db with a bunch of data and thus takes a long while for it to run. Because of this if I run...

$ docker exec -d CONTAINER python /path/to/myscript.py

Was curious if it is possible to run

$ docker exec -it CONTAINER /bin/bash
$ root@container-hash /# ps -ax

And see if that process is still running?

Upvotes: 0

Views: 1213

Answers (1)

n2o
n2o

Reputation: 6477

You can connect to your docker container via exec as long as the python script has not finished yet. When it is done, the container will be stopped and you can't connect any more.

As long as it is running, you can use docker logs CONTAINER to show the output of your container, if any.

Upvotes: 1

Related Questions