edit-icon download-icon

Install Docker

Last Updated: Jan 26, 2018

Preface

Currently, to install Docker on Linux system, you must meet the following requirements in terms of the system version:

  • CentOS: 7
  • Debian: 7.7 (Wheezy LTS), 8.0 (Jessie LTS), and 9 (Stretch)
  • Fedora: 24 and 25
  • Ubuntu: 16.04 (Xenial LTS), 14.04 (Trusty LTS), and 17.04 (Zesty)

You can install Docker using Alibaba Cloud Docker CE image source site.

Installation help

Ubuntu 14.04/16.04 (use apt-get for installation)

  1. # Step 1: Install some necessary system tools
  2. sudo apt-get update
  3. sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
  4. # Step 2: Install the GPG certificate
  5. curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
  6. # Step 3: Write the software source information
  7. sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
  8. # Step 4: Update and install Docker-CE
  9. sudo apt-get -y update
  10. sudo apt-get -y install docker-ce
  11. # Install Docker CE of a specified version:
  12. # Step 1: Search for the required version of Docker-CE:
  13. # apt-cache madison docker-ce
  14. # docker-ce | 17.03.1~ce-0~ubuntu-xenial | http://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial/stable amd64 Packages
  15. # docker-ce | 17.03.0~ce-0~ubuntu-xenial | http://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial/stable amd64 Packages
  16. # Step 2: Install Docker CE of a specified version: (The version is, for example, the preceding 17.03.1~ce-0~ubuntu-xenial)
  17. # sudo apt-get -y install docker-ce=[VERSION]

CentOS 7 (use yum for installation)

  1. # Step 1: Install some necessary system tools
  2. sudo yum install -y yum-utils device-mapper-persistent-data lvm2
  3. # Step 2: Add the software source information
  4. sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
  5. # Step 3: Update and install Docker-CE
  6. sudo yum makecache fast
  7. sudo yum -y install docker-ce
  8. # Step 4: Activate the Docker service
  9. sudo service docker start
  10. # Note:
  11. # The official software source enables the latest software by default. You can edit the software source to obtain various versions of the software package. For example, the test version of the software source is not officially set available. You can enable it by using the following ways. Similarly, you can enable a variety of test versions.
  12. # vim /etc/yum.repos.d/docker-ee.repo
  13. # Change the enabled=0 under the [docker-ce-test] to enabled=1
  14. #
  15. # Install Docker-CE of a specified version:
  16. # Step 1: Search for the required version of Docker-CE:
  17. # yum list docker-ce.x86_64 --showduplicates | sort -r
  18. # Loading mirror speeds from cached hostfile
  19. # Loaded plugins: branch, fastestmirror, langpacks
  20. # docker-ce.x86_64 17.03.1.ce-1.el7.centos docker-ce-stable
  21. # docker-ce.x86_64 17.03.1.ce-1.el7.centos @docker-ce-stable
  22. # docker-ce.x86_64 17.03.0.ce-1.el7.centos docker-ce-stable
  23. # Available Packages
  24. # Step 2: Install Docker-CE of a specified version: (The version is, for example, the preceding 17.03.0.ce.1-1.el7.centos)
  25. # sudo yum -y install docker-ce-[VERSION]

Installation verification

  1. root@iZbp12adskpuoxodbkqzjfZ:$ docker version
  2. Client:
  3. Version: 17.03.0-ce
  4. API version: 1.26
  5. Go version: go1.7.5
  6. Git commit: 3a232c8
  7. Built: Tue Feb 28 07:52:04 2017
  8. OS/Arch: linux/amd64
  9. Server:
  10. Version: 17.03.0-ce
  11. API version: 1.26 (minimum version 1.12)
  12. Go version: go1.7.5
  13. Git commit: 3a232c8
  14. Built: Tue Feb 28 07:52:04 2017
  15. OS/Arch: linux/amd64
  16. Experimental: false

References

To uninstall the earlier version of Docker and install the test and development version of Docker, see relevant instructions in the official document.

Thank you! We've received your feedback.