Docker Linux Installation

From NovaOrdis Knowledge Base
Revision as of 18:46, 19 April 2018 by Ovidiu (talk | contribs) (→‎Ubuntu)
Jump to navigation Jump to search

Internal

Overview

Verified with Centos 7.

Prerequisites

A 3.8 kernel or later is required.

RedHat/Centos

Setting a yum Repository

Create a docker.repo in /etc/yum.repos.d:

[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg

Alternative URL for Centos 6: https://yum.dockerproject.org/repo/main/centos/6 Oracle Linux: https://yum.dockerproject.org/repo/main/oraclelinux/6/

This is an example of how to use an "entitled" RH repository:

Using yum with registry.access.redhat.com Images

Remove Older Releases

Remove older Docker releases,

yum list installed | grep docker
yum erase ...

Install

yum install docker-engine

The yum installation procedure enables the docker server to start at boot:

systemctl is-enabled docker
enabled

If not, enable it:

systemctl enable docker

Reboot

docker version


Client:
 Version:      17.03.1-ce
 API version:  1.27
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Fri Mar 24 00:36:45 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.03.1-ce
 API version:  1.27 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Fri Mar 24 00:36:45 2017
 OS/Arch:      linux/amd64
 Experimental: false

Installation Verification

Docker Installation Verification

Docker Installation for OpenShift

Ubuntu

Docker installation on Ubuntu is described here, in order:

A summary is available below. The sequence was used to install 18.03.0-ce on Ubuntu 16.04 xenial.

Setup the repository. As root:

 apt-get update
 apt-get install apt-transport-https ca-certificates curl software-properties-common
 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
 apt-key fingerprint 0EBFCD88
 add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

Note that $(lsb_release -cs) should return 'xenial' or equivalent. The last command adds the Docker repository in /etc/apt/sources.list.

Install Docker CE. As root:

Update the package index again after setting up the Docker repository:

apt-get update

Then install the latest docker-ce:

apt-get install docker-ce

Test:

docker run hello-world

Start at boot:

systemctl enable docker

Configure a user other than "root" to be able to use the docker client to connect to the server. For details on why we needed to do this see Docker Concepts - Client/Server Communication. The installation procedure should have created the 'docker' group already:

usermod -aG docker <unprivileged-user-to-operate-docker-server>

Test access for unprivileged user. As that user:

docker run hello-world

Inspect storage backend details.

Also run:

Docker Installation Verification