Docker step-by-step

Docker step-by-step


Below we present docker step-by-step, these steps will guide on how to use docker container and how to create it. If you follow these steps you will be able to manage docker container successfully.

Installing Docker CentOS 6.5

To install docker on CentOS-6 install the docker-io package with the following command:

  • $ sudo yum install docker-io

Once docker is installed, you will need to start the service in order to use it.

  • $ sudo service docker start

To start the docker service on boot:

  • $ sudo chkconfig docker on

Create Docker Image

Pull CentOS 6 version. This is because we are currently running CentOS 6.5 in our IO server.

  • $ sudo docker pull centos:centos6

To verify the images have been fetched locally:

  • $ sudo docker images centos

Let’s create Docker container

Create Docker container without port forwarding

Show docker images.

  • $ docker images

Now let’s create a Docker container.

  • sudo docker run -d --privileged=true --name processmakerpoc  -i -t processmaker/normal /bin/bash

Once we created we show the docker container with the command below.

  • docker ps

 

Note: This type of container it can only be accessed by internal server, which means it cannot be accessed from external.

Docker will provide an IP address to the container e.g. 127.17.0.1 so with this IP you can only access it internally.

And once it is created the container we can edit it.

-         $ docker attach 14f7550671dd // This is the container ID

-         Install ProcessMaker, Apache, Mysql and PHP inside the container, and start the apache and mysql services.

-         Once everything is installed, configure the apache of the docker container.

To exit from the docker container do CTRL + P and CTRL + Q. This it won’t turn off the container.

Proxy Reverse

Add a file in the apache configuration directory.

-         $ cd /et c/httpd/conf.d/

-         $ /etc/httpd/conf.d/proxyreverse.conf

Then add this content below

<virtualhost *:80>
        ServerName poc.processmaker.io
        # Set up reverse proxy
        ProxyRequests Off
        ProxyPreserveHost On
        ProxyPass / http://172.17.0.1/
        ProxyPassReverse / http://172.17.0.1/
</virtualhost>

 

Restart apache

-         $ service httpd restart

-         $ /etc/init.d/httpd restart

 

Note: This configuration it is used to make proxy reverse and it is useful for docker container without port forwarding.

This configuration will allow that external users can access to the docker container content.