Official Document: https://docs.docker.com/
Docker supports multi-platform installation (Linux/windows/os X).
Because Docker native supports Linux, it can be run directly on Linux, and the Windows and OS X platforms need to be run with a lightweight Linux VM.
Ubuntu installation
The instructions for installing Docker on Ubuntu depend on whether you are using Docker Enterprise (Docker EE) or the Docker Community Edition (Docker CE).
Reference Document: https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/
Installing using the Warehouse
Before installing Docker CE on a new host for the first time, you need to set up a Docker warehouse. After that, you can install and update Docker from the repository.
Set up warehouses
1. Update apt
Package Index:
$ sudo apt-get update
2. Install the package so that it allows the apt
use of warehouses over https:
$ sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
3. Add Docker's official GPG key:
https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Confirm that you now have a fingerprint key by searching for the last 8 characters of the key 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
.
$ sudo apt-key fingerprint 0EBFCD88pub 4096R/0EBFCD88 2017-02-22 密钥指纹 = 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88uid Docker Release (CE deb) <[email protected]>sub 4096R/F273FCD8 2017-02-22
4. Use the following command to set up the stable warehouse. Even if you want to build from __edge __ or test repositories, you always need a stable warehouse. To add a __edge __ or test warehouse, add edge or test (or both) after the word stable in the following command.
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Note: The above lsb_release -cs
subcommand returns the name of your Ubuntu release, such as Xenial.
Installing the Docker CE
1. Update apt
Package Index:
$ sudo apt-get update
2, install the latest version has Dcoker CE
$ sudo apt-get install docker-ce
3. On a production system, you should install a specific version of Docker CE instead of always using the latest version. The following command lists the available versions.
$ apt-cache Madison Docker-ce Docker-ce| 17.12.0~ce-0~ubuntu |https://download.docker.com/linux/ubuntu xenial/stable AMD64 Packages docker-ce| 17.09.1~ce-0~ubuntu |https://download.docker.com/linux/ubuntu xenial/stable AMD64 Packages docker-ce| 17.09.0~ce-0~ubuntu |https://download.docker.com/linux/ubuntu xenial/stable AMD64 Packages docker-ce| 17.06.2~ce-0~ubuntu |https://download.docker.com/linux/ubuntu xenial/stable AMD64 Packages docker-ce| 17.06.1~ce-0~ubuntu |https://download.docker.com/linux/ubuntu xenial/stable AMD64 Packages docker-ce| 17.06.0~ce-0~ubuntu | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages docker-ce | 17.03.2~ce-0~ ubuntu-xenial | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages docker-ce | 17.03.1~ce-0~ ubuntu-xenial | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages docker-ce | 17.03.0~ce-0~ ubuntu-xenial | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
Install the specified version:
install docker-ce=<VERSION>
4. Verify that the Docker CE is properly installed by running the Hello-world image.
$ sudo docker run hello-worldunable to find image' Hello-world:latest ' locallylatest:pullingFrom Library/hello-worldca4f61b1923c:pull completedigest:sha256:66ef312bbac49c39a89aa9bcc3cb4f3c9e7de3788c944158df3ee0176d32b751status:downloaded Newer imageFor Hello-world:latesthelloFrom docker! This message shows the your installation appears to be working correctly. To generateThis 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 this image which runs the executable that produces the OUTPU T you 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 an Ubuntu container with : $ docker run-it Ubuntu bashshare images, a Utomate workflows, and more with a free Docker Id:https://cloud.docker.com/for More examples and ideas, Visi T:https://docs.docker.com/engine/userguide/
Other
To view the Docker version:
$ sudo docker versionclient:version:17.12.0-ce API version:1.35 Go version:go1.9.2 GitCommit:c97c6d6 built:wedDec2720:11:192017 os/arch:linux/amd64server: Engine: version:17.12.0-ce API Span class= "Hljs-keyword" >version:1.35 (minimum version 1.12) go Version:go1.9.2 Git commit: C97c6d6 built:wed dec 27 20:09:53 2017 os/arch:linux/amd64 Experimental:false
Displays Docker system information, including the number of mirrors and containers:
$ sudo docker infocontainers:7 Running:0 Paused:0 Stopped:7Images:2Server Version:17.12.0-cestorage driver:aufs Root Dir:/Var/lib/docker/aufs backing Filesystem:extfs Dirs:Dirperm1 Supported:Truelogging driver:json-filecgroup Driver:cgroupfsPlugins:Volume:local Network:bridge host MacvlanNull overlay log:awslogs fluentd gcplogs gelf journald json-file logentries splunk syslogSwarm:inactiveRuntimes:runcDefault runtime:runcinit binary:docker-initcontainerd Version:89623f28b87a6004d4b785663257362d1658a729runc Version:b2567b37d7b75eb4cf325b77297b140ea686ce8finit Version:949e6fasecurity Options:apparmor Seccomp Profile:Defaultkernel Version:4.13.0-26-genericoperating System:ubuntu 16.04.3 LTSOSType:linuxArchitecture:x86_64CPUs: 1total Memory: 1.924gibname:ubuntuid:oxzy:hygr:x6xj:cldf:h2ug:kxcy:j6md:< Span class= "Hljs-number" >32wv:uorn:e2qy:trtl:isi6docker Root Dir:/var/lib/dockerdebug Mode (client): falsedebug Mode (server): falseregistry:https: //index.docker.io/v1/labels:experimental: falseInsecure Registries: 127.0.0.0/8live Restore Enabled: falsewarning:no swap limit support
(ii) Docker installation (Ubuntu)