Tuesday, November 8, 2016

Ubuntu: How to Install Docker in Ubuntu 16.04 LTS VMWare

To Prepare Ubuntu
  1. Download Ubuntu version 16.04 from https://www.ubuntu.com/download/server
  2. Open VMWare and install Ubuntu with downloaded file.
To Install Docker


Update your apt sources

Docker’s APT repository contains Docker 1.7.1 and higher. To set APT to use packages from the Docker repository:
  1. Log into your machine as a user with sudo or root privileges.
  2. Open a terminal window.
  3. Update package information, ensure that APT works with the https method, and that CA certificates are installed.
    $ sudo apt-get update
    $ sudo apt-get install apt-transport-https ca-certificates
    
  4. Add the new GPG key.
    $ sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
  1. Run the following command, substituting the entry for your operating system for the placeholder <REPO>.
    $ echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
    
  2. Update the APT package index.
    $ sudo apt-get update
    
  3. Verify that APT is pulling from the right repository.
    When you run the following command, an entry is returned for each version of Docker that is available for you to install. Each entry should have the URL https://apt.dockerproject.org/repo/. The version currently installed is marked with ***.The output below is truncated.
    $ apt-cache policy docker-engine
    
      docker-engine:
        Installed: 1.12.2-0~trusty
        Candidate: 1.12.2-0~trusty
        Version table:
       *** 1.12.2-0~trusty 0
              500 https://apt.dockerproject.org/repo/ ubuntu-trusty/main amd64 Packages
              100 /var/lib/dpkg/status
           1.12.1-0~trusty 0
              500 https://apt.dockerproject.org/repo/ ubuntu-trusty/main amd64 Packages
           1.12.0-0~trusty 0
              500 https://apt.dockerproject.org/repo/ ubuntu-trusty/main amd64 Packages
           1.11.2-0~trusty 0
              500 https://apt.dockerproject.org/repo/ ubuntu-trusty/main amd64 Packages
           1.11.1-0~trusty 0
              500 https://apt.dockerproject.org/repo/ ubuntu-trusty/main amd64 Packages
    
    From now on when you run apt-get upgradeAPT pulls from the new repository.

Prerequisites by Ubuntu Version

  • Ubuntu Xenial 16.04 (LTS)
For Ubuntu Trusty, and Xenial, it’s recommended to install the linux-image-extra-* kernel packages. The linux-image-extra-* packages allows you use the aufs storage driver.
To install the linux-image-extra-* packages:
  1. Open a terminal on your Ubuntu host.
  2. Update your package manager.
     $ sudo apt-get update
    
  3. Install the recommended packages.
     $ sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual

Install

Make sure you have installed the prerequisites for your Ubuntu version.
Then, install Docker using the following:
  1. Log into your Ubuntu installation as a user with sudo privileges.
  2. Update your APT package index.
     $ sudo apt-get update
    
  3. Install Docker.
     $ sudo apt-get install docker-engine
    
  4. Start the docker daemon.
     $ sudo service docker start
    
  5. Verify docker is installed correctly.
     $ sudo docker run hello-world
    
    This command downloads a test image and runs it in a container. When the container runs, it prints an informational message. Then, it exits.


You can find more docker installation step for other ubuntu version from this link https://docs.docker.com/engine/installation/linux/ubuntulinux .

The most common issue to install in other Ubuntu version is "Cannot locate docker-engine". It is because docker packge has been existed inside Ubuntu repo, you can try the following command to install docker.

sudo apt-get install docker.io


Ref:
https://docs.docker.com/engine/installation/linux/ubuntulinux/
http://stackoverflow.com/questions/39645118/docker-unable-to-locate-package-docker-engine

No comments:

Post a Comment