Reputation: 3
I have pulled conda/miniconda2 image and I'm able to run it but what so ever changes I made goes when I restart the container. As I'm new to docker I don't know much about it.
My question is that how can I write a docker file so that all libraries like tensorflow theano etc comes installed in it ?
Upvotes: 0
Views: 360
Reputation: 442
Assuming you have done plenty of research on this topic, I will provide a solution. We can achieve this two ways:
(1) build an image from scratch using "Dockerfile" or "dockerfile". A "dockerfile" allows you to place all the dependencies needed for installation of your packages or libraries.
(2) You can simply run a container of the base-image of the desired OS flavor.Then, go into the container and install all your packages and commit the changes to Docker Hub.
(1) [Answer] Simply create a Dockerfile and build the image using the desired linux flavor. Check link how to build an image, using a Dockerfile, with all the desired packages and libraries.
(2) [Answer]
Step1: Running a container in detach mode.
Assign a name to the container you want to run so it is easy to locate and reattach again to it. Learn about the flags I used in the flags link below.
docker run --name miniconda2Container -i -t -d conda/miniconda2 /bin/bash
(2) Step2: Use the name of the container you have assigned to run it with the attach command.
docker attach miniconda2Container
(2) Step3: Once inside the container proceed to install all your packages.
apt-get install <package or library or anything else>
(2) Up to now, you have done everything properly. When you finished installing everything, detach the container by pressing "Ctrl-p-q" at the same time. You should receive something like the following statement.
(2) Then, Commit the changes that you have made inside the container the following way:
docker commit -m "This is my update image" miniconda2Container abeltre1/miniconda2:latest
Finally, you can use the [REPOSITORY[:TAG]] to access the image and check that all your packages are installed. In my case the image is: abeltre1/miniconda2:latest.
Upvotes: 1