我是在阿里云服务器上安装的docker,centOS版本。
一、检查内核版本
[root@iZudpsyuwyc6wiZ ~]# uname -r
3.10.0-514.26.2.el7.x86_64
二、安装docker
[root@iZudpsyuwyc6wiZ ~]# sudo wget -qO- https://get.docker.com | sh
# Executing docker install script, commit: 6bf300318ebaab958c4adc341a8c7bb9f3a54a1a
+ sh -c 'yum install -y -q yum-utils'
+ sh -c 'yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo'
Loaded plugins: fastestmirror
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
base | 3.6 kB 00:00:00
docker-ce-stable | 3.5 kB 00:00:00
epel | 5.3 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/16): base/7/x86_64/filelists_db | 7.1 MB 00:00:00
(2/16): base/7/x86_64/other_db | 2.6 MB 00:00:00
(3/16): docker-ce-stable/x86_64/updateinfo | 55 B 00:00:00
(4/16): docker-ce-stable/x86_64/filelists_db | 16 kB 00:00:01
(5/16): docker-ce-stable/x86_64/primary_db | 34 kB 00:00:00
(6/16): epel/x86_64/prestodelta | 557 B 00:00:00
(7/16): epel/x86_64/filelists_db | 12 MB 00:00:00
(8/16): epel/x86_64/updateinfo_zck | 1.5 MB 00:00:00
(9/16): docker-ce-stable/x86_64/other_db | 113 kB 00:00:00
(10/16): extras/7/x86_64/prestodelta | 73 kB 00:00:00
(11/16): extras/7/x86_64/filelists_db | 249 kB 00:00:00
(12/16): extras/7/x86_64/other_db | 131 kB 00:00:00
(13/16): epel/x86_64/other_db | 3.3 MB 00:00:00
(14/16): updates/7/x86_64/filelists_db | 5.2 MB 00:00:00
(15/16): updates/7/x86_64/other_db | 764 kB 00:00:00
(16/16): updates/7/x86_64/prestodelta | 945 kB 00:00:00
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.
warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
Public key for containerd.io-1.2.6-3.3.el7.x86_64.rpm is not installed
Importing GPG key 0x621E9F35:
Userid : "Docker Release (CE rpm) <docker@docker.com>"
Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
From : https://download.docker.com/linux/centos/gpg
setsebool: SELinux is disabled.
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.
[root@iZudpsyuwyc6wiZ ~]#
三、检查docker版本
[root@iZudpsyuwyc6wiZ ~]# docker version
Client: Docker Engine - Community
Version: 19.03.2
API version: 1.40
Go version: go1.12.8
Git commit: 6a30dfc
Built: Thu Aug 29 05:28:55 2019
OS/Arch: linux/amd64
Experimental: false
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
四、启动docker服务
[root@iZudpsyuwyc6wiZ ~]# service docker start
Redirecting to /bin/systemctl start docker.service
五、查看docker信息
[root@iZudpsyuwyc6wiZ ~]# docker info
Client:
Debug Mode: false
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 19.03.2
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-514.26.2.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 1.796GiB
Name: iZudpsyuwyc6wiZ
ID: S22J:L5ZO:WKWL:36PF:QTUC:H5JH:UQSH:RCCC:AJSX:L4V4:7QDP:JAOS
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false