Installation of the Docker method under Ubuntu Daquan

Source: Internet
Author: User
Tags gpg docker hub docker run

Preparatory work
System Requirements
Docker CE supports the following versions of the Ubuntu operating system:

Artful 17.10 (Docker CE 17.11 Edge)
Zesty 17.04
Xenial 16.04 (LTS)
Trusty 14.04 (LTS)
The Docker CE can be installed on a 64-bit x86 platform or ARM platform. In the Ubuntu release, the long-term support version of LTS (Long-term-support), which is supported by 5 years of upgrade maintenance, is more stable, so it is recommended to use the LTS version in the production environment and the latest LTS version is Ubuntu 16.04.

Uninstalling older versions
An older version of Docker is called Docker or docker-engine, uninstall the old version using the following command:

$ sudo apt-get remove docker \
Docker-engine \
Docker.io
Ubuntu 14.04 Optional Kernel modules
Starting with Ubuntu 14.04, a subset of kernel modules have been moved to the optional kernel module package (linux-image-extra-*) to reduce the size of the kernel package. A properly installed system should include an optional kernel module package, and some cropped systems might be able to refine it. The AUFS kernel driver is part of the optional kernel module, and as a recommended Docker storage tier driver, it is generally recommended to install the optional kernel module package to use AUFS.

If the system does not have an optional kernel module installed, you can install the optional kernel module package by executing the following command:

$ sudo apt-get update

$ sudo apt-get install \
linux-image-extra-$ (uname-r) \
Linux-image-extra-virtual
Using APT to install
Because the apt source uses HTTPS to ensure that the software is not tampered with during the download. Therefore, we first need to add a package that uses HTTPS transport and a CA certificate.

$ sudo apt-get update

$ sudo apt-get install \
APT-TRANSPORT-HTTPS \
Ca-certificates \
Curl \
Software-properties-common
In view of domestic network problems, it is strongly recommended to use domestic sources, the official source please check in the comments.

To verify the legality of the downloaded package, you need to add a GPG key for the software source.

$ Curl-fssl HTTPS://MIRRORS.USTC.EDU.CN/DOCKER-CE/LINUX/UBUNTU/GPG | sudo apt-key add-

Official source $ Curl-fssl HTTPS://DOWNLOAD.DOCKER.COM/LINUX/UBUNTU/GPG | sudo apt-key add-

Then we need to add the Docker software source to the Source.list

$ sudo add-apt-repository \
"Deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu \
$ (LSB_RELEASE-CS) \
Stable

Official source $ sudo add-apt-repository \ "Deb [Arch=amd64] Https://download.docker.com/linux/ubuntu \$ (lsb_release-cs) \stable"

The above command adds a stable version of the Docker CE APT image source, and if you need the latest or beta version of Docker CE, change the stable to edge or test. Starting with Docker 17.06, the edge test version of the APT image source will also contain a stable version of Docker.

Installing the Docker CE
Update the APT package cache and install Docker-ce:

$ sudo apt-get update

$ sudo apt-get install Docker-ce
Automatic installation using scripts
In a test or development environment Docker has provided a set of convenient installation scripts to simplify the installation process, which can be installed on Ubuntu systems using this set of scripts:

$ Curl-fssl Get.docker.com-o get-docker.sh
$ sudo sh get-docker.sh--mirror Aliyun
After executing this command, the script will automatically prepare everything and install the Edge version of the Docker CE in the system.

Start Docker CE
$ sudo systemctl enable Docker
$ sudo systemctl start docker
Ubuntu 14.04 Please start with the following command:

$ sudo service docker start
Set up a Docker user group
By default, the Docker command communicates with the Docker engine using a Unix socket. Only users of the root user and Docker group can access the Unix sockets of the Docker engine. For security reasons, root users are not directly used on Linux systems. Therefore, it is a better practice to join users who need to use Docker in the Docker user group.

To set up a docker group:

$ sudo groupadd Docker
To join the current user to the Docker group:

$ sudo usermod-ag Docker $USER
Exit the current terminal and log back in to perform the following tests.

Test if Docker is installed correctly
$ Docker Run Hello-world

Unable to find image ' hello-world:latest ' locally
Latest:pulling from Library/hello-world
Ca4f61b1923c:pull Complete
Digest:sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c
status:downloaded newer image for Hello-world:latest

Hello from docker!
This message shows the your installation appears to be working correctly.

To generate this message, Docker took the following steps:

    1. The Docker client contacted the Docker daemon.
    2. The Docker daemon pulled the "Hello-world" image from the Docker Hub.
      (AMD64)
    3. The Docker daemon created a new container from that image which runs the
      Executable that produces the output is currently reading.
    4. The Docker daemon streamed that output to the Docker client, which sent it
      to your terminal.

To try something + ambitious, you can run a Ubuntu container with:
$ docker run-it Ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://cloud.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
If you can output the above information correctly, the installation is successful.

Installation of the Docker method under Ubuntu Daquan

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.