Automatically building containers and creating images

I want to create a container automatically from a specified link. Like I have a server that returns a link to the build environment. By build environment i mean a set of components that need to be build in a container. How can i automatically do that with a script or some programming language ? So i want to create a script that take the components to be built from the docker repository and then invoke docker to build them automatically. It shouldn’t involve the user writing any code like sudo apt-get install openssl or something of that sort. Also please let me know which programming language seems to be good or can be used. I hope the query is clear . Please help me out .


It sounds like you are asking for something that is like a Dockerfile. Take a look at and see if that covers your needs.

Thank you. It did. :slight_smile:

I wanated to use the docker-py API, and have installed it. I am following the documentation strictly
from docker import Client

cli = Client(base_url=‘unix://var/run/docker.sock’)

after this i am trying to do :
client.Containers() or trying other commands it returns an error

File “/usr/local/lib/python2.7/dist-packages/docker/api/”, line 70
in containers , res = self._result(self._get(u, params=params), True)

and it is not running. What should I do ?
Thanks for the help.

I am using docker-py to remotely invoke docker to perform operations. The problem is I am using docker on windows and I am having trouble in making docker listen to a tcp port. I know the docker.conf file has to be changed. I can do that in ubuntu, but i don’t know how it works on windows. I am getting an error when I run the python script,
cli = Client(base_url=‘unix://var/run/docker.sock’). I also tried changing it to, cli = client(base_url=’-H tcp:// -H unix:///var/run/docker.sock’). I still get an error which says:
Traceback (most recent call last):
File “”, line 1, in
TypeError: ‘module’ object is not callable

which i think is because of not changing the TCP port. Please help me out.

Thanks in advance.