LFCS and LFCE: How to install an Apache (httpd) as a Docker application on Ubuntu?


During the exam to obtain the LFCS or the LFCE it can happen to have one or more exercises that require to solve or do tasks involving Docker. So I wrote this post to give you some familiarity or let's said to facilitate your approach with Docker. 

Let's being starting our Virtual Machine with Ubuntu and then installing Docker on it.

sudo apt install docker.io

Then we are going to start the docker service.

sudo systemctl start docker



Now we can double check that the service is running with this command: 

sudo systemctl status docker



Now we will search for the http container, with this command:

sudo docker search apache



We are going to retrieve the container now. 

sudo docker pull docker.io/httpd



Let's check the list of the installed containers. 

sudo docker images

Now we are going to start the httpd docker container. 

sudo docker run httpd

For the purpose of this test I will use now a different terminal without closing the current one. In the second terminal I have a Debian host in the same network. And I will try to connect to the dockr httpd container.

In order to do so, I will install lynx as a text-based browser into the Debian host. 

sudo apt-get install lynx


And now I am going to connect to the httpd

(remember to use the IP address that you will have and not that one that I wrote in the command below)

lynx http://172.17.0.2



Comments

Leave as a comment:

Archive