1、docker安装部署
说明:蓝色背景部分时执行的命令,绿色部分是执行命令后重点需要关注的信息。
[root@LJL ~]# rpm -qa |grep yum
yum-langpacks-0.4.2-7.el7.noarch
yum-3.4.3-168.el7.centos.noarch
PackageKit-yum-1.1.10-2.el7.centos.x86_64
yum-utils-1.1.31-54.el7_8.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch
[root@LJL ~]# rpm -qa |grep device-mapper
device-mapper-persistent-data-0.8.5-3.el7.x86_64
device-mapper-libs-1.02.170-6.el7.x86_64
device-mapper-1.02.170-6.el7.x86_64
device-mapper-event-libs-1.02.170-6.el7.x86_64
device-mapper-multipath-0.4.9-133.el7.x86_64
device-mapper-multipath-libs-0.4.9-133.el7.x86_64
device-mapper-event-1.02.170-6.el7.x86_64
[root@LJL ~]# rpm -qa |grep lvm
lvm2-libs-2.02.187-6.el7.x86_64
llvm-private-7.0.1-1.el7.x86_64
lvm2-2.02.187-6.el7.x86_64
[root@LJL ~]# 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
[root@LJL ~]# cd /etc/yum.repos.d/
[root@LJL yum.repos.d]# ls
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Sources.repo CentOS-x86_64-kernel.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-SIG-ansible-29.repo CentOS-Vault.repo docker-ce.repo
[root@LJL yum.repos.d]# ll
total 48
-rw-r--r--. 1 root root 1664 Oct 23 2020 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 Oct 23 2020 CentOS-CR.repo
-rw-r--r--. 1 root root 649 Oct 23 2020 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 314 Oct 23 2020 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 Oct 23 2020 CentOS-Media.repo
-rw-r--r-- 1 root root 1192 Mar 31 2020 CentOS-SIG-ansible-29.repo
-rw-r--r--. 1 root root 1331 Oct 23 2020 CentOS-Sources.repo
-rw-r--r--. 1 root root 8515 Oct 23 2020 CentOS-Vault.repo
-rw-r--r--. 1 root root 616 Oct 23 2020 CentOS-x86_64-kernel.repo
-rw-r--r-- 1 root root 1919 Apr 7 06:13 docker-ce.repo
[root@LJL yum.repos.d]# yum -y install docker-ce-18.06.2.ce
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.nju.edu.cn
* centos-ansible-29: mirrors.nju.edu.cn
* extras: mirrors.nju.edu.cn
* updates: mirrors.bfsu.edu.cn
base | 3.6 kB 00:00:00
centos-ansible-29 | 3.0 kB 00:00:00
docker-ce-stable | 3.5 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/4): extras/7/x86_64/primary_db | 246 kB 00:00:00
(2/4): docker-ce-stable/7/x86_64/primary_db | 75 kB 00:00:02
(3/4): updates/7/x86_64/primary_db | 15 MB 00:00:03
(4/4): docker-ce-stable/7/x86_64/updateinfo | 55 B 00:00:03
Resolving Dependencies
--> Running transaction check
---> Package docker-ce.x86_64 0:18.06.2.ce-3.el7 will be installed
--> Processing Dependency: container-selinux >= 2.9 for package: docker-ce-18.06.2.ce-3.el7.x86_64
--> Running transaction check
---> Package container-selinux.noarch 2:2.119.2-1.911c772.el7_8 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================================
Installing:
docker-ce x86_64 18.06.2.ce-3.el7 docker-ce-stable 41 M
Installing for dependencies:
container-selinux noarch 2:2.119.2-1.911c772.el7_8 extras 40 k
Transaction Summary
==============================================================================================================================================================
Install 1 Package (+1 Dependent package)
Total download size: 41 M
Installed size: 168 M
Downloading packages:
(1/2): container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm | 40 kB 00:00:00
warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/docker-ce-18.06.2.ce-3.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY0 ETA
Public key for docker-ce-18.06.2.ce-3.el7.x86_64.rpm is not installed
(2/2): docker-ce-18.06.2.ce-3.el7.x86_64.rpm | 41 MB 00:00:25
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 1.6 MB/s | 41 MB 00:00:25
Retrieving key from https://download.docker.com/linux/centos/gpg
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
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch 1/2
setsebool: SELinux is disabled.
Installing : docker-ce-18.06.2.ce-3.el7.x86_64 2/2
Verifying : docker-ce-18.06.2.ce-3.el7.x86_64 1/2
Verifying : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch 2/2
Installed:
docker-ce.x86_64 0:18.06.2.ce-3.el7
Dependency Installed:
container-selinux.noarch 2:2.119.2-1.911c772.el7_8
Complete!
[root@LJL yum.repos.d]# systemctl start docker
[root@LJL yum.repos.d]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@LJL yum.repos.d]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2022-04-13 05:22:03 PDT; 25s ago
Docs: https://docs.docker.com
Main PID: 1998 (dockerd)
CGroup: /system.slice/docker.service
├─1998 /usr/bin/dockerd
└─2005 docker-containerd --config /var/run/docker/containerd/containerd.toml
Apr 13 05:22:02 LJL dockerd[1998]: time="2022-04-13T05:22:02.749933043-07:00" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc420...odule=grpc
Apr 13 05:22:02 LJL dockerd[1998]: time="2022-04-13T05:22:02.750134609-07:00" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc420...odule=grpc
Apr 13 05:22:02 LJL dockerd[1998]: time="2022-04-13T05:22:02.750149304-07:00" level=info msg="Loading containers: start."
Apr 13 05:22:02 LJL dockerd[1998]: time="2022-04-13T05:22:02.926840509-07:00" level=info msg="Default bridge (docker0) is assigned with an IP add...P address"
Apr 13 05:22:03 LJL dockerd[1998]: time="2022-04-13T05:22:03.001651040-07:00" level=info msg="Loading containers: done."
Apr 13 05:22:03 LJL dockerd[1998]: time="2022-04-13T05:22:03.038184430-07:00" level=info msg="Docker daemon" commit=6d37f41 graphdriver(s)=overla...18.06.2-ce
Apr 13 05:22:03 LJL dockerd[1998]: time="2022-04-13T05:22:03.038348854-07:00" level=info msg="Daemon has completed initialization"
Apr 13 05:22:03 LJL dockerd[1998]: time="2022-04-13T05:22:03.043022184-07:00" level=warning msg="Could not register builder git source: failed to... in $PATH"
Apr 13 05:22:03 LJL systemd[1]: Started Docker Application Container Engine.
Apr 13 05:22:03 LJL dockerd[1998]: time="2022-04-13T05:22:03.057110173-07:00" level=info msg="API listen on /var/run/docker.sock"
Hint: Some lines were ellipsized, use -l to show in full.
[root@LJL yum.repos.d]# docker version
Client:
Version: 18.06.2-ce
API version: 1.38
Go version: go1.10.3
Git commit: 6d37f41
Built: Sun Feb 10 03:46:03 2019
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.06.2-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: 6d37f41
Built: Sun Feb 10 03:48:29 2019
OS/Arch: linux/amd64
Experimental: false
[root@LJL yum.repos.d]# docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 18.06.2-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: 468a545b9edcd5932818eb9de8e72413e616e86e
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-1160.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 972.3MiB
Name: LJL
ID: GEGS:YSOP:CBZW:WJ52:G3T6:TTTO:5ARL:CDSH:AAWH:XHCB:ZUWD:4M6Q
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
[root@LJL yum.repos.d]# curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
docker version >= 1.12
{"registry-mirrors": ["http://f1361db2.m.daocloud.io"]}
Success.
You need to restart docker to take effect: sudo systemctl restart docker
[root@LJL yum.repos.d]# systemctl restart docker.service
[root@LJL yum.repos.d]# docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 18.06.2-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: 468a545b9edcd5932818eb9de8e72413e616e86e
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-1160.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 972.3MiB
Name: LJL
ID: GEGS:YSOP:CBZW:WJ52:G3T6:TTTO:5ARL:CDSH:AAWH:XHCB:ZUWD:4M6Q
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
http://f1361db2.m.daocloud.io/
Live Restore Enabled: false
[root@LJL yum.repos.d]# yum -y install bash-completion
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.nju.edu.cn
* centos-ansible-29: mirrors.nju.edu.cn
* extras: mirrors.nju.edu.cn
* updates: mirrors.bfsu.edu.cn
Package 1:bash-completion-2.1-8.el7.noarch already installed and latest version
Nothing to do
[root@LJL yum.repos.d]# source /usr/share/bash-completion/bash_completion
2、命令汇总
501 2022-04-13_05:14:53 rpm -qa |grep yum
502 2022-04-13_05:15:20 rpm -qa |grep device-mapper
503 2022-04-13_05:15:42 rpm -qa |grep lvm
504 2022-04-13_05:19:29 yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
505 2022-04-13_05:19:39 cd /etc/yum.repos.d/
506 2022-04-13_05:19:40 ls
507 2022-04-13_05:19:41 ll
508 2022-04-13_05:20:33 yum -y install docker-ce-18.06.2.ce
509 2022-04-13_05:22:02 systemctl start docker
510 2022-04-13_05:22:12 systemctl enable docker
511 2022-04-13_05:22:28 systemctl status docker
512 2022-04-13_05:23:14 docker version
513 2022-04-13_05:23:37 docker info
514 2022-04-13_05:36:40 curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
515 2022-04-13_05:37:33 systemctl restart docker.service
516 2022-04-13_05:37:40 docker info
517 2022-04-13_05:38:59 yum -y install bash-completion
518 2022-04-13_05:39:31 source /usr/share/bash-completion/bash_completion