The tensorflow docker container is available at https://hub.docker.com/r/tensorflow/tensorflow/ to extend this container with additional libraries such as requests
I'm aware of two options.
- Run the container and run
pip install requests
- Append
pip install requests
to thedockerFile
that builds this container
Is there an alternative option ? Something like creating the tensorflow/tensorflow
container from a dockerFile and then installing requests
on this container.
Reading How to extend an existing docker image? to accomplish this create a dockerFile with these contents ? :
FROM tensorflow/tensorflow
RUN pip install requests
you could enter the running container via:
or if a name is set:
Your original assertion is correct, create a new Dockerfile:
now build it:
run it:
execute a shell in it (
docker ps -ql
gives us an id of the last container to run):get logs from it:
The ability to extend other images is what makes docker really powerful, in addition you can go look at their Dockerfile:
https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tools/docker
and start from there as well without extending their docker image, this is a best practice for people using docker in production so you know everything is built in-house and not by some hacker sneaking stuff into your infrastructure. Cheers! and happy building