Network Automation using YANG Models across XE, XR, & NX

Install Docker

Docker is a container management environment. Containers are light weight encapsulated computer environments. Each container has its own running copy of Linux and shares the host computer's copy of the kernel. This means there's no hypervisor, and no extended bootup process. In this module, you will turn your CentOS VM into a Docker host by installing and setting Docker up. In subsequent modules, you will pull and run a Docker container as your development environment that will be used for the remainder of the lab.

Launch Terminal

Right-click the desktop background of your CentOS VM and in the drop down click to open a Terminal window.


Install Docker CE

Use yum to install Docker Community Edition. This will be pulled from our local repo.

When prompted, your user has sudo privileges with password cisco.123

        
            sudo yum -y install docker-ce
        
    

Modify Docker to Use Internal Docker Registry

For this lab, we'll be using an internal Docker Registry versus using the main Docker Hub to pull a Docker image for the sake of time. Copy the text below to modify the Docker service. Line 13 is the change we're making to use our Docker Registry.

        
            cat << EOF | sudo tee /usr/lib/systemd/system/docker.service
            [Unit]
            Description=Docker Application Container Engine
            Documentation=https://docs.docker.com
            After=network-online.target firewalld.service
            Wants=network-online.target

            [Service]
            Type=notify
            # the default is not to use systemd for cgroups because the delegate issues still
            # exists and systemd currently does not support the cgroup feature set required
            # for containers run by docker
            ExecStart=/usr/bin/dockerd --insecure-registry ciscolive-docker-registry-2:5000
            ExecReload=/bin/kill -s HUP $MAINPID
            # Having non-zero Limit*s causes performance problems due to accounting overhead
            # in the kernel. We recommend using cgroups to do container-local accounting.
            LimitNOFILE=infinity
            LimitNPROC=infinity
            LimitCORE=infinity
            # Uncomment TasksMax if your systemd version supports it.
            # Only systemd 226 and above support this version.
            #TasksMax=infinity
            TimeoutStartSec=0
            # set delegate yes so that systemd does not reset the cgroups of docker containers
            Delegate=yes
            # kill only the docker process, not all processes in the cgroup
            KillMode=process
            # restart the docker process if it exits prematurely
            Restart=on-failure
            StartLimitBurst=3
            StartLimitInterval=60s

            [Install]
            WantedBy=multi-user.target
            EOF
            
        
    

Start Docker Process

Make sure the Docker process starts up automatically upon a reboot by using Systemd: systemctl enable docker.

        
            sudo systemctl enable docker
            
        
    

Now, start the Docker process by using Systemctl: systemctl enable docker.

        
            sudo systemctl start docker
            
        
    

Verify Docker Process

Verify the status of the Docker process and that it is successfully running as shown below using systemctl status docker:

        
            sudo systemctl status docker
            
        
    
        
            [root@ciscolive-pod00-centos pod00user]# systemctl status docker
              docker.service - Docker Application Container Engine
               Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
               Active: active (running) since Wed 2017-06-14 22:33:12 EDT; 7h ago
                 Docs: https://docs.docker.com
             Main PID: 17933 (dockerd)
               Memory: 349.6M
               CGroup: /system.slice/docker.service
                       \u251c\u250017933 /usr/bin/dockerd --insecure-registry ciscolive-docker-registry-2:5000
                       \u2514\u250017941 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --...

            Jun 14 22:33:12 ciscolive-pod00-centos dockerd[17933]: time="2017-06-14T22:33:11.998920212-04:00" level=info msg="[grap...rlay"
            Jun 14 22:33:12 ciscolive-pod00-centos dockerd[17933]: time="2017-06-14T22:33:12.003921749-04:00" level=info msg="Graph...onds"
            Jun 14 22:33:12 ciscolive-pod00-centos dockerd[17933]: time="2017-06-14T22:33:12.004807893-04:00" level=info msg="Loadi...art."
            Jun 14 22:33:12 ciscolive-pod00-centos dockerd[17933]: time="2017-06-14T22:33:12.013836799-04:00" level=info msg="Firew...alse"
            Jun 14 22:33:12 ciscolive-pod00-centos dockerd[17933]: time="2017-06-14T22:33:12.174419478-04:00" level=info msg="Defau...ress"
            Jun 14 22:33:12 ciscolive-pod00-centos dockerd[17933]: time="2017-06-14T22:33:12.229697598-04:00" level=info msg="Loadi...one."
            Jun 14 22:33:12 ciscolive-pod00-centos dockerd[17933]: time="2017-06-14T22:33:12.244172495-04:00" level=info msg="Daemo...tion"
            Jun 14 22:33:12 ciscolive-pod00-centos dockerd[17933]: time="2017-06-14T22:33:12.244234982-04:00" level=info msg="Docke....1-ce
            Jun 14 22:33:12 ciscolive-pod00-centos systemd[1]: Started Docker Application Container Engine.
            Jun 14 22:33:12 ciscolive-pod00-centos dockerd[17933]: time="2017-06-14T22:33:12.257360200-04:00" level=info msg="API l...sock"
            Hint: Some lines were ellipsized, use -l to show in full.
        
    

Continue on to the next module to learn how to pull Docker images.