Linux 8yml安装Docker容器详细步骤
安装工具类
yum install -y yum-utils device-mapper-persistent-data lvm2
成功:
[root@bogon Docker]# yum install -y yum-utils device-mapper-persistent-data lvm2
Repository extras is listed more than once in the configuration
Docker CE Stable - x86_64 7.7 kB/s | 3.5 kB 00:00
Package yum-utils-4.0.21-3.el8.noarch is already installed.
Package device-mapper-persistent-data-0.9.0-4.el8.x86_64 is already installed.
Package lvm2-8:2.03.12-10.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
yum源添加docker
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
成功:
[root@bogon Docker]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Repository extras is listed more than once in the configuration
Adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
[root@bogon Docker]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Repository extras is listed more than once in the configuration
Adding repo from: http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
<👉👉👉👉yml安装报错:Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist解决办法👈👈👈👈>
安装docker
yum install -y docker-ce docker-ce-cli containerd.io
成功:
[root@bogon Docker]# yum install -y docker-ce docker-ce-cli containerd.io
Repository extras is listed more than once in the configuration
Docker CE Stable - x86_64 30 kB/s | 3.5 kB 00:00
Dependencies resolved.
=======================================================================================================================================================
Package Architecture Version Repository Size
=======================================================================================================================================================
Installing:
containerd.io x86_64 1.6.24-3.1.el8 docker-ce-stable 34 M
docker-ce x86_64 3:24.0.6-1.el8 docker-ce-stable 24 M
docker-ce-cli x86_64 1:24.0.6-1.el8 docker-ce-stable 7.2 M
Installing dependencies:
container-selinux noarch 2:2.167.0-1.module_el8.5.0+911+f19012f9 AppStream 54 k
docker-ce-rootless-extras x86_64 24.0.6-1.el8 docker-ce-stable 4.9 M
fuse-overlayfs x86_64 1.7.1-1.module_el8.5.0+890+6b136101 AppStream 73 k
fuse3 x86_64 3.2.1-12.el8 base 50 k
fuse3-libs x86_64 3.2.1-12.el8 base 94 k
libslirp x86_64 4.4.0-1.module_el8.5.0+890+6b136101 AppStream 70 k
slirp4netns x86_64 1.1.8-1.module_el8.5.0+890+6b136101 AppStream 51 k
Installing weak dependencies:
docker-buildx-plugin x86_64 0.11.2-1.el8 docker-ce-stable 13 M
docker-compose-plugin x86_64 2.21.0-1.el8 docker-ce-stable 13 M
Enabling module streams:
container-tools rhel8
Transaction Summary
=======================================================================================================================================================
Install 12 Packages
Total download size: 96 M
Installed size: 367 M
Downloading Packages:
(1/12): fuse3-libs-3.2.1-12.el8.x86_64.rpm 858 kB/s | 94 kB 00:00
(2/12): fuse3-3.2.1-12.el8.x86_64.rpm 447 kB/s | 50 kB 00:00
(3/12): container-selinux-2.167.0-1.module_el8.5.0+911+f19012f9.noarch.rpm 325 kB/s | 54 kB 00:00
(4/12): fuse-overlayfs-1.7.1-1.module_el8.5.0+890+6b136101.x86_64.rpm 573 kB/s | 73 kB 00:00
(5/12): slirp4netns-1.1.8-1.module_el8.5.0+890+6b136101.x86_64.rpm 492 kB/s | 51 kB 00:00
(6/12): libslirp-4.4.0-1.module_el8.5.0+890+6b136101.x86_64.rpm 308 kB/s | 70 kB 00:00
(7/12): docker-buildx-plugin-0.11.2-1.el8.x86_64.rpm 2.9 MB/s | 13 MB 00:04
(8/12): docker-ce-cli-24.0.6-1.el8.x86_64.rpm 3.5 MB/s | 7.2 MB 00:02
(9/12): docker-ce-24.0.6-1.el8.x86_64.rpm 3.0 MB/s | 24 MB 00:07
(10/12): docker-ce-rootless-extras-24.0.6-1.el8.x86_64.rpm 3.3 MB/s | 4.9 MB 00:01
(11/12): containerd.io-1.6.24-3.1.el8.x86_64.rpm 3.7 MB/s | 34 MB 00:09
(12/12): docker-compose-plugin-2.21.0-1.el8.x86_64.rpm 6.4 MB/s | 13 MB 00:01
-------------------------------------------------------------------------------------------------------------------------------------------------------
Total 9.3 MB/s | 96 MB 00:10
Docker CE Stable - x86_64 10 kB/s | 1.6 kB 00:00
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://mirrors.aliyun.com/docker-ce/linux/centos/gpg
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : docker-compose-plugin-2.21.0-1.el8.x86_64 1/12
Running scriptlet: docker-compose-plugin-2.21.0-1.el8.x86_64 1/12
Running scriptlet: container-selinux-2:2.167.0-1.module_el8.5.0+911+f19012f9.noarch 2/12
Installing : container-selinux-2:2.167.0-1.module_el8.5.0+911+f19012f9.noarch 2/12
Running scriptlet: container-selinux-2:2.167.0-1.module_el8.5.0+911+f19012f9.noarch 2/12
Installing : containerd.io-1.6.24-3.1.el8.x86_64 3/12
Running scriptlet: containerd.io-1.6.24-3.1.el8.x86_64 3/12
Installing : docker-buildx-plugin-0.11.2-1.el8.x86_64 4/12
Running scriptlet: docker-buildx-plugin-0.11.2-1.el8.x86_64 4/12
Installing : docker-ce-cli-1:24.0.6-1.el8.x86_64 5/12
Running scriptlet: docker-ce-cli-1:24.0.6-1.el8.x86_64 5/12
Installing : libslirp-4.4.0-1.module_el8.5.0+890+6b136101.x86_64 6/12
Installing : slirp4netns-1.1.8-1.module_el8.5.0+890+6b136101.x86_64 7/12
Installing : fuse3-libs-3.2.1-12.el8.x86_64 8/12
Running scriptlet: fuse3-libs-3.2.1-12.el8.x86_64 8/12
Installing : fuse3-3.2.1-12.el8.x86_64 9/12
Installing : fuse-overlayfs-1.7.1-1.module_el8.5.0+890+6b136101.x86_64 10/12
Running scriptlet: fuse-overlayfs-1.7.1-1.module_el8.5.0+890+6b136101.x86_64 10/12
Installing : docker-ce-3:24.0.6-1.el8.x86_64 11/12
Running scriptlet: docker-ce-3:24.0.6-1.el8.x86_64 11/12
Installing : docker-ce-rootless-extras-24.0.6-1.el8.x86_64 12/12
Running scriptlet: docker-ce-rootless-extras-24.0.6-1.el8.x86_64 12/12
Running scriptlet: container-selinux-2:2.167.0-1.module_el8.5.0+911+f19012f9.noarch 12/12
Running scriptlet: docker-ce-rootless-extras-24.0.6-1.el8.x86_64 12/12
Verifying : fuse3-3.2.1-12.el8.x86_64 1/12
Verifying : fuse3-libs-3.2.1-12.el8.x86_64 2/12
Verifying : container-selinux-2:2.167.0-1.module_el8.5.0+911+f19012f9.noarch 3/12
Verifying : fuse-overlayfs-1.7.1-1.module_el8.5.0+890+6b136101.x86_64 4/12
Verifying : libslirp-4.4.0-1.module_el8.5.0+890+6b136101.x86_64 5/12
Verifying : slirp4netns-1.1.8-1.module_el8.5.0+890+6b136101.x86_64 6/12
Verifying : containerd.io-1.6.24-3.1.el8.x86_64 7/12
Verifying : docker-buildx-plugin-0.11.2-1.el8.x86_64 8/12
Verifying : docker-ce-3:24.0.6-1.el8.x86_64 9/12
Verifying : docker-ce-cli-1:24.0.6-1.el8.x86_64 10/12
Verifying : docker-ce-rootless-extras-24.0.6-1.el8.x86_64 11/12
Verifying : docker-compose-plugin-2.21.0-1.el8.x86_64 12/12
Installed:
container-selinux-2:2.167.0-1.module_el8.5.0+911+f19012f9.noarch containerd.io-1.6.24-3.1.el8.x86_64
docker-buildx-plugin-0.11.2-1.el8.x86_64 docker-ce-3:24.0.6-1.el8.x86_64
docker-ce-cli-1:24.0.6-1.el8.x86_64 docker-ce-rootless-extras-24.0.6-1.el8.x86_64
docker-compose-plugin-2.21.0-1.el8.x86_64 fuse-overlayfs-1.7.1-1.module_el8.5.0+890+6b136101.x86_64
fuse3-3.2.1-12.el8.x86_64 fuse3-libs-3.2.1-12.el8.x86_64
libslirp-4.4.0-1.module_el8.5.0+890+6b136101.x86_64 slirp4netns-1.1.8-1.module_el8.5.0+890+6b136101.x86_64
Complete!
安装docker
yum install -y docker-ce docker-ce-cli containerd.io
成功:
[root@bogon Docker]# yum install -y docker-ce docker-ce-cli containerd.io
Repository extras is listed more than once in the configuration
Last metadata expiration check: 0:06:41 ago on Sun 08 Oct 2023 10:18:37 PM PDT.
Package docker-ce-3:24.0.6-1.el8.x86_64 is already installed.
Package docker-ce-cli-1:24.0.6-1.el8.x86_64 is already installed.
Package containerd.io-1.6.24-3.1.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
启动docker
systemctl start docker
查询docker状态
systemctl status docker
卸载删除docker
# 删除安装包
yum remove docker*
# 删除镜像
rm -rf /var/lib/docker