Mr.Sh4nnon
Mr.Sh4nnon

Reputation: 337

How can I re-access a bash console in a Docker?

Im starting some python scripts on a DGX Server running a Nvidia Tensorflow docker. I've managed once to re enter the docker file, where I could see that the process was still running. However I couldn't see the new prints in the console anymore.

Is there a way I can run the docker e.g. a whole night and when I re enter it I can see my complete printed logs in the bash console?

Upvotes: 0

Views: 84

Answers (2)

Mr.Sh4nnon
Mr.Sh4nnon

Reputation: 337

$ docker attach [CONTAINER ID]

did the job to re-enter my console over ssh. However as Clayton Harbich pointed out

$ docker logs [OPTIONS] CONTAINER ID

is what I needed without knowing. Re-entering the console with attach doesn't show the history of console entries. So with those two commands I was able to see what happened and can further observe the scripts process.

Upvotes: 0

Clayton Harbich
Clayton Harbich

Reputation: 513

I think you are wanting logging. I have only done application logging but maybe this will help: https://docs.docker.com/engine/reference/commandline/logs/

$ docker logs [OPTIONS] CONTAINER

edit: Additional links:

log.rowanto.com/docker-console-logs-problem

docs.docker.com/config/containers/logging

Upvotes: 2

Related Questions