官网:https://www.docker.com/
Mac或Win安装:
下载地址:https://hub.docker.com/?overlay=onboarding
Linux安装:
-q: 简略wget的输出内容
O-: wget 标准输出而不是文件
| :管道,将前面的执行结果输出给sh
sh: 执行shell脚本
[root@VM_0_17_centos docker]# sudo wget -qO- https://get.docker.com | sh
# Executing docker install script, commit: 6bf300318ebaab958c4adc341a8c7bb9f3a54a1a
Warning: the "docker" command appears to already exist on this system.
If you already have Docker installed, this script can cause trouble, which is
why we're displaying this warning and provide the opportunity to cancel the
installation.
If you installed the current Docker package using this script and are using it
again to update Docker, you can safely ignore this message.
You may press Ctrl+C now to abort this script.
+ sleep 20
+ sh -c 'yum install -y -q yum-utils'
Package yum-utils-1.1.31-50.el7.noarch already installed and latest version
+ sh -c 'yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo'
Loaded plugins: fastestmirror, langpacks
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
+ '[' stable '!=' stable ']'
+ sh -c 'yum makecache'
Loaded plugins: fastestmirror, langpacks
docker-ce-stable | 3.5 kB 00:00:00
epel | 5.4 kB 00:00:00
extras | 3.4 kB 00:00:00
os | 3.6 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/13): epel/7/x86_64/prestodelta | 4.9 kB 00:00:00
(2/13): docker-ce-stable/x86_64/filelists_db | 16 kB 00:00:00
(3/13): docker-ce-stable/x86_64/other_db | 112 kB 00:00:00
(4/13): epel/7/x86_64/other_db | 3.3 MB 00:00:01
(5/13): epel/7/x86_64/updateinfo_zck | 1.5 MB 00:00:00
(6/13): extras/7/x86_64/prestodelta | 73 kB 00:00:00
(7/13): extras/7/x86_64/filelists_db | 249 kB 00:00:00
(8/13): extras/7/x86_64/other_db | 131 kB 00:00:00
(9/13): epel/7/x86_64/filelists_db | 12 MB 00:00:01
(10/13): updates/7/x86_64/prestodelta | 945 kB 00:00:00
(11/13): updates/7/x86_64/other_db | 764 kB 00:00:00
(12/13): os/7/x86_64/other_db | 2.6 MB 00:00:01
(13/13): updates/7/x86_64/filelists_db | 5.2 MB 00:00:01
Loading mirror speeds from cached hostfile
Metadata Cache Created
+ '[' -n '' ']'
+ sh -c 'yum install -y -q docker-ce'
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
/usr/bin/dockerd has not been configured as an alternative for dockerd
+ sh -c 'docker version'
Client:
Version: 18.09.7
API version: 1.39
Go version: go1.10.8
Git commit: 2d0083d
Built: Thu Jun 27 17:56:06 2019
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.1
API version: 1.40 (minimum version 1.12)
Go version: go1.12.5
Git commit: 74b1e89
Built: Thu Jul 25 21:19:36 2019
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.6
GitCommit: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc:
Version: 1.0.0-rc8
GitCommit: 425e105d5a03fabd737a126ad93d62a9eeede87f
docker-init:
Version: 0.18.0
GitCommit: fec3683
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:
sudo usermod -aG docker your-user
Remember that you will have to log out and back in for this to take effect!
WARNING: Adding a user to the "docker" group will grant the ability to run
containers which can be used to obtain root privileges on the
docker host.
Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
for more information.
将当前用户加入到docker组里
[root@VM_0_17_centos docker]# sudo usermod -aG docker root