说明:这里只介绍rpm的安装方式,出于工作需要,不能连接外网;其它一些安装方式,请大家自行选择。
安装版本:docker-engine-1.7.1-1.el6.x86_64.rpm。
操作步骤:
1. 将上面的docker安装包,上传到服务器的/root下;
2. 安装docker:
[root@test ~]# yum install –y docker-engine-1.7.1-1.el6.x86_64.rpm 或者 [root@test ~]# rpm -ivh docker-engine-1.7.1-1.el6.x86_64.rpm
我用上面两种方式都试过,没问题的。
3. 验证docker是否安装成功:
[root@test ~]#service docker start [root@test ~]# docker version Client: Version: 17.12.0-ce API version: 1.35 Go version: go1.9.2 Git commit: c97c6d6 Built: Wed Dec 27 20:10:14 2017 OS/Arch: linux/amd64 Server: Engine: Version: 17.12.0-ce API version: 1.35 (minimum version 1.12) Go version: go1.9.2 Git commit: c97c6d6 Built: Wed Dec 27 20:12:46 2017 OS/Arch: linux/amd64 Experimental: false
[root@test ~]# docker info Containers: 1 Running: 0 Paused: 0 Stopped: 1 Images: 7 Server Version: 17.12.0-ce Storage Driver: overlay2 Backing Filesystem: xfs Supports d_type: true Native Overlay Diff: true Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: 89623f28b87a6004d4b785663257362d1658a729 runc version: b2567b37d7b75eb4cf325b77297b140ea686ce8f init version: 949e6fa Security Options: seccomp Profile: default Kernel Version: 3.10.0-862.11.6.el7.x86_64 Operating System: CentOS Linux 7 (Core) OSType: linux Architecture: x86_64 CPUs: 2 Total Memory: 7.637GiB Name: test ID: 32AF:5VGQ:O7EZ:RNA6:ZFW7:RBLU:PWR5:JWP3 Docker Root Dir: /var/lib/docker Debug Mode (client): false Debug Mode (server): false Username: dockerzhcy Registry: https://index.docker.io/v1/ Labels: Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false
知识扩展:
1. docker加入开机自启:
[root@test ~]#chkconfig docker on --加入 [root@test ~]#chkconfig --list docker --查看
2. 授权非root用户使用docker
[root@test ~]#gpasswd -a test docker [root@test ~]#usermod -a -G docker test 切换到test用户下 [test@test ~]$service docker restart [test@test ~]$docker version
至此,docker安装完成。