1

I run machine learning model in docker container. The model will go through train , eval , test and interactive 4 process. I use following ways to start docker:

sudo docker run  --runtime=nvidia --name tensorflow_bert_dst -it  -p 8888:8888 tensorflow/tensorflow:1.13.2-gpu-py3-jupyter

The process of training is so long that I close the terminal and let docker running in the server. Several hours later, I want to use following method check the result and interactive with the model.

docker attach tensorflow_bert_dst

But the docker hang and do not show any result, how to enter the running container and see the last time result and interactive with my model?

andy
  • 1,951
  • 5
  • 16
  • 30
  • Does this answer your question? [How do I get into a Docker container's shell?](https://stackoverflow.com/questions/30172605/how-do-i-get-into-a-docker-containers-shell) – leopal Nov 01 '19 at 13:10
  • I tried and it not I want. Because it can enter docker container but I can't see the result – andy Nov 01 '19 at 13:19
  • Could you give reference on how you runmachine in docker, I 'm interested. – abdoulsn Jan 22 '20 at 21:17

1 Answers1

3

You can access the logs of docker containers via:

docker logs -f <containerid/name> 

Please note this command shows the logs of the main process of the container (the process that you started the container with and this process should log to stdout/stderr.

So if you start your container like:

docker run --name mylongrunningcontainer <image name> <long running command that outputs to stdout/stderr>

then you can check the output anytime with:

docker logs -f mylongrunningcontainer
Farhad Farahi
  • 35,528
  • 7
  • 73
  • 70