In this blog, I would like to demonstrate the Docker 17.03.0 CE edition installation on Ubuntu 16.0.4 VM machine. And later on little practice can be shown using containers in a series of blogs. Please keep visiting for weekly new blogs or subscribe it. If you are interested to follow this site blogs, please send e-mail [with your linkedin message ] to approve with authentication.
Assume you have an unbuntu machine or a Virtual machine [VM] configured. And in this blog you can see on how to install the Docker 17.03.0 CE [as on this blog’s date] with screen display outputs:
$ sudo service docker restart
However, if the Active column shows inactive or maintenance as the status, your Docker service is not running. In such cases, restart the Docker service, as shown here:
$ sudo service docker restart Install Docker on Unbuntu: 1.Add the Docker package repository path for Ubuntu 16.04 to your APT sources, as shown below: $ sudo sh -c "echo deb https://apt.dockerproject.org/repo \ ubuntu-xenial main > /etc/apt/sources.list.d/docker.list" 2.Add the GNU Privacy Guard (GPG) key by running the following command: $ sudo apt-key adv --keyserver \ hkp://p80.pool.sks-keyservers.net:80 --recv-keys \ If the above format is expired; you can try as below: ==== Alternate method with screen output ====> $sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D Executing: /tmp/apt-key-gpghome.YU0Rk7y5kX/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D gpg: key F76221572C52609D: 7 signatures not checked due to missing keys gpg: key F76221572C52609D: public key "Docker Release Tool (releasedocker) <email@example.com>" imported gpg: Total number processed: 1 gpg: imported: 1
3.Resynchronize with the package repository using the below command: $ sudo apt-get update Now docker software is in your unbuntu machine. 4. Now, you can Install Docker and start Docker service: $ sudo apt-get install -y docker-engine 5.Now you have installed the Docker Engine, we need to verify our installation by running docker --version as shown below: $ docker --version We have successfully installed Docker version 17.03.0 community edition. Other options is; in a single script by avoiding the above steps you can install it: If you are working on Ubuntu, follow the below command: ==================== Screen output ==========> vskumar@ubuntu:/var/log$ sudo wget -qO- https://get.docker.io/ | sh |more [sudo] password for vskumar: # Executing docker install script, commit: 11aa13e Warning: the "docker" command appears to already exist on this system. If you already have installed Docker, this script can cause trouble, which is why we're displaying this warning and provide the opportunity to cancel the installation. If you installed the current Docker package using this script and are using it again to update Docker, you can safely ignore this message. You may press Ctrl+C now to abort this script. + sleep 20 + sudo -E sh -c apt-get update -qq >/dev/null ============== Since I have already installed, I have breaked this process ====> But, if you try this script; it takes some time to download and install docker for the whole process. Be patient to see the final result. Later check the docker version to reconfirm. Using the below command. $docker --version It is very easy to install docker with the above step(s) in your Ubuntu machine. Assuming you have studied the theory part of docker usage I am moving forward to lab practice. Now, let us do some practice with docker images/containers. We will do the below steps: 1. Downloading the first Docker image: we will download a sample hello-world docker image using the following command: $ sudo docker pull hello-world 2. Once the image is downloaded, they can be verified using the docker images subcommand, as given below: To check the image run the below command: $sudo docker run hello-world It displays the message “Hello from Docker!” You have set up your first Docker container and it is running now. 3. How to Troubleshoot with Docker containers?: If you want to troubleshoot with container, the first step is to check the Docker's running status by using the below command: $ sudo service docker status It displays the status and shows as Docker 'Active running' message on the screen along with other messages. Press ctrl+C to come out from the display. =========== Partial content from the above command =====> vskumar@ubuntu:/var/log$ sudo service docker status ● docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2017-11-25 02:54:42 PST; 3h 56min ago Docs: https://docs.docker.com Main PID: 3769 (dockerd) Tasks: 19 Memory: 43.6M CPU: 1min 21.184s CGroup: /system.slice/docker.service ├─3769 /usr/bin/dockerd -H fd:// └─3778 docker-containerd --config /var/run/docker/containerd/containerd.toml ===============================> For some reasons, if the Active column shows inactive or maintenance as the status, it means your Docker service is not running. In that case to restart the Docker service, use the below command:
$ sudo service docker restart
We will see in the next blog, some more exercises on Docker containers and images.