Reputation: 3
I am new to tensorflow and docker and I am trying to make a docker container where I can use tensorflow with GPU.
After trying different things I managed to set up my nvidia drivers and I can run:
nvidia-docker run -it gcr.io/tensorflow/tensorflow bash
which opens me a docker container with a tensorflow image.
This is good as it creates me the tensorflow docker container where I can install also keras and use it, but if I exit from this container I loose all my created files and installed packages.
How is it possible once I exit this container to go back to it and have all my files and packages still in there?
Below is a screenshot with my docker images (which are too many now because of my many tries to go around this issue and because some tensorflow images did not install properly):
I hope there is an easy way to do this?
Upvotes: 0
Views: 2340
Reputation: 1510
nvidia-docker run -it
create NEW container
you want to open existed container use
nvidia-docker start -i CONTAINER_ID
or
nvidia-docker start -i NAMES
and if you want more terminals
nvidia-docker exec -it CONTAINER_ID bash
or
nvidia-docker exec -it NAMES bash
Update
Run container when the container is close
$ docker ps -a [ruby-2.3.1p112]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
acd83fb407b4 rfcn:rfcn "/bin/bash" 4 days ago Exited (0) 28 hours ago rfcn
$ nvidia-docker start -i rfcn [ruby-2.3.1p112]
root@acd83fb407b4:/#
Open another terminal when the container is running
$ nvidia-docker exec -it rfcn bash [ruby-2.3.1p112]
root@acd83fb407b4:/#
Upvotes: 1