How To Install Docker on Ubuntu 18.04 & 16.04 LTS

Docker is a container-based application framework that allows deploying programs that are run as containers. They’re similar to virtual machines, but containers are more portable, more resource-friendly, and more dependent on the host operating system.

Install Docket on Ubuntu

See Also:

  • What is Docker & Docker Container?
  • How To Install Docker CE on CentOS/RHEL 7/6
  • 1. Uninstall Old Versions

    First remove any default Docker packages from the system. Execute mention command to remove old packages.

    # sudo apt-get purge docker lxc-docker docker-engine docker.io
    

    2. Prerequisites

    Now install the required packages on your system for installing Docker on Ubuntu.

    # sudo apt-get install  curl  apt-transport-https ca-certificates software-properties-common
    

    3. Add Docker Repository

    Now import docker official GPG key using before adding the repository.

    # curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add
    

    After that add the Docker GPG key on your system use-mention command to add the repository.

    # sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
    

    4. Install Docker on Ubuntu

    Now your system is ready to install Docker community edition on ubuntu system.

    # sudo apt-get update
    # sudo apt-get install docker-ce
    

    5: Start Docker Service

    After, Docker package has been installed, start the docker service and enable it at boot time using the below commands:

    On Ubuntu 18.04

    # systemctl start docker
    # systemctl enable docker
    

    On Ubuntu 16.04

    # service docker start
    # chkconfig dokcer on
    

    6: Check Docker Version

    Run mention command to check the docker version.

    # docker version
    
    Client:
     Version:           18.09.1
     API version:       1.39
     Go version:        go1.10.6
     Git commit:        4c52b90
     Built:             Wed Jan  9 19:35:31 2019
     OS/Arch:           linux/amd64
     Experimental:      false
    
    Server: Docker Engine - Community
     Engine:
      Version:          18.09.1
      API version:      1.39 (minimum version 1.12)
      Go version:       go1.10.6
      Git commit:       4c52b90
      Built:            Wed Jan  9 19:02:44 2019
      OS/Arch:          linux/amd64
      Experimental:     false
    

    7: Check Docker Info

    Now, you can check some docker info using mention command.

    # docker info
    
    Containers: 1
     Running: 0
     Paused: 0
     Stopped: 1
    Images: 1
    Server Version: 18.09.1
    Storage Driver: overlay2
     Backing Filesystem: extfs
     Supports d_type: true
     Native Overlay Diff: true
    Logging Driver: json-file
    Cgroup Driver: cgroupfs
    Plugins:
     Volume: local
     Network: bridge host macvlan null overlay
     Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
    Swarm: inactive
    Runtimes: runc
    Default Runtime: runc
    Init Binary: docker-init
    containerd version: 9754871865f7fe2f4e74d43e2fc7ccd237edcbce
    runc version: 96ec2177ae841256168fcf76954f7177af9446eb
    init version: fec3683
    Security Options:
     apparmor
     seccomp
      Profile: default
    Kernel Version: 4.15.0-43-generic
    Operating System: Ubuntu 18.04.1 LTS
    OSType: linux
    Architecture: x86_64
    CPUs: 1
    Total Memory: 1.947GiB
    Name: docker
    ID: WRRO:URTU:SU5I:7GN4:K432:RTO5:5WCZ:2VT6:TCXJ:XT5B:EVCQ:NLBD
    Docker Root Dir: /var/lib/docker
    Debug Mode (client): false
    Debug Mode (server): false
    Registry: https://index.docker.io/v1/
    Labels:
    Experimental: false
    Insecure Registries:
     127.0.0.0/8
    Live Restore Enabled: false
    Product License: Community Engine
    

    8: Test Docker

    Run the Docker hello-world container to test if the installation completed successfully.

    # docker run hello-world
    

    Test Docker

    Enjoy it!

No Responses

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.