First steps with Docker.

By Darío Rivera
Posted On in Docker

In our previous post we saw how to perform our first Hello World in Docker. Through a simple Dockerfile we created an image from another and initialized a web server with our Hello World. Today's exercise will be slightly different, and we will create an image from a repo on Github.

This same exercise is in the Getting Started of any clean installation of Docker. The first command we will use will be the following:

docker run --name repo alpine/git clone

This command creates a new container from the alpine/git image, if it does not exist, downloads it, and downloads the repository passed as a parameter inside the container. After this we can copy the contents inside the container to our local file system and build a new docker image.

docker cp repo:/git/getting-started/ .
cd getting-started
docker build -t docker101tutorial .

Finally we can run our container with the following command.

docker run -d -p 81:80 --name docker-tutorial docker101tutorial

We should be able to access the application with the following URL.

Acerca de Darío Rivera


Ingeniero de desarrollo en PlacetoPay , Medellín. Darío ha trabajado por más de 6 años en lenguajes de programación web especialmente en PHP. Creador del microframework DronePHP basado en Zend y Laravel.

Sólo aquellos que han alcanzado el éxito saben que siempre estuvo a un paso del momento en que pensaron renunciar.