Mosudi Isiaka

Mosudi Isiaka

Data Center Infrastructure

Contact Me

DOCKER INSTALLATION

Docker website contains simple but precise and effective installation procedure. Navigating through the Docker website home page by clicking on “Get Started with Docker” . Choose the appropriate server OS, in this case I deployed on Ubuntu 14.04 64bit server. The Docker setup involves installation of Docker Engine then software/server images could be run in containers.

Installation Steps

  1. Log into your Ubuntu serrver, in this case Ubuntu server intsance on Amazon EC2. This is a Linux server and it requires SSH Client running on you local computer system. Amazon also provide a Java SSH Client that could be used directly from Java supported browser. Java installation on the local computer is a requirement.

    Login to the Amazon Web Services console access EC2 virtual servers to create a new cloud server or use available cloud instace, created earlier.


    Select the instance and connect

    Select and copy ssh -i "miobuntuec2.pem" ubuntu@ec2-52-40-100-221.us-west-2.compute.amazonaws.com Open a terminal session and navigate to the directory where you private key is locate and paste into a terminal

    Press the return key on your keyboard and type “yes” when prompted and press the return key again to connect to a terminal session on the server.
    Docker installation requires a user with sudo privileges
    Confirm if curl is intsalled by typing “which curl” .
    $ which curl
    curl is installed if it returns
    /usr/bin/curl $
    If curl isn’t installed, install it after updating your manager:
    $ sudo apt-get update
    $ sudo apt-get -y install curl
    Then curl is available to fetch the script that does get the latest Docker package.
    $ curl -fsSL https://get.docker.com/ | sh
    The system prompts you for your sudo password
    After complete installation you are adviced to disconnect you terminal session and reconnect again, otherwise, Docker commands will require a user with sudo privileges.
    Perhap, you will loose nothing but gain everything by running the command
    $ sudo usermod -aG docker $USER
    Disconnect and reconnect again too start using Docker

    Starting Docker Containers


    Setup Apache Web Server and the Mysql Database server in Docker containers. The server operating system will be similar to the EC2 Instance used for this process, Ubuntu 14.04.4 LTS (Trusty Tahr)
    Using Docker command
    $ docker run ubuntu
    will pull the latest version of Ubuntu 16.04 whereas our requirement as projected is 14.04
    Therefore, I will run the command
    $ docker run ubuntu:trusty
    $ docker run -t -i ubuntu:trusty /bin/bash
    Pressing “ctrl” + “p” then release “p” while holding “ctrl” ”q” keys release the bash session Using Docker command
    $ docker ps -l
    Provides the container ID of the last started Docker container. Then I can use the ID to create ubuntu servers with unique identities: web and database servers
    While my id from this command = “ a642f317cda9”
    Then saving the running container by commit commands
    $ docker commit a642f317cda9 mosudi/crossoverweb
    $ docker commit a642f317cda9 mosudi/crossoverdb
    The command
    $ docker run -h mosudi.web -i -p 802:80 -p 10002:10000 -t mosudi/crossoverweb /bin/bash
    provides a container with
    • Hostname = mosudi.web
    • forward port 804 on the EC2 install to HTTP port 80 making providing remote web access to mosudi.web
    • forward port 10004 to port 10000 for webmin

    Likewise
    $ docker run -h mosudi.db -i -p 803:80 -p 10003:10000 -p 3308:3306 -t mosudi/crossoverdb /bin/bash
  2. provides a container with
    • Hostname = mosudi.db
    • forward port 805 on the EC2 install to HTTP port 80 making providing remote web access to mosudi.web
    • forward port 10005 to port 10000 for webmin
    • forward port 3309 to port 3306 for mysql