1. install yum-utils
yum install -y yum-utils
2. install Docker Yum repo
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
3. install Docker Engine
yum install docker-ce docker-ce-cli containerd.io
4 done.
if you have some error log report when setp 3 as below.
[root@japan-tac-161-117 yum.repos.d]# yum install docker-ce
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package docker-ce.x86_64 3:20.10.8-3.el7 will be installed
--> Processing Dependency: containerd.io >= 1.4.1 for package: 3:docker-ce-20.10.8-3.el7.x86_64
--> Processing Dependency: docker-ce-cli for package: 3:docker-ce-20.10.8-3.el7.x86_64
--> Processing Dependency: docker-ce-rootless-extras for package: 3:docker-ce-20.10.8-3.el7.x86_64
--> Running transaction check
---> Package containerd.io.x86_64 0:1.4.9-3.1.el7 will be installed
---> Package docker-ce-cli.x86_64 1:20.10.8-3.el7 will be installed
--> Processing Dependency: docker-scan-plugin(x86-64) for package: 1:docker-ce-cli-20.10.8-3.el7.x86_64
---> Package docker-ce-rootless-extras.x86_64 0:20.10.8-3.el7 will be installed
--> Processing Dependency: fuse-overlayfs >= 0.7 for package: docker-ce-rootless-extras-20.10.8-3.el7.x86_64
--> Processing Dependency: slirp4netns >= 0.4 for package: docker-ce-rootless-extras-20.10.8-3.el7.x86_64
--> Running transaction check
---> Package docker-ce-rootless-extras.x86_64 0:20.10.8-3.el7 will be installed
--> Processing Dependency: fuse-overlayfs >= 0.7 for package: docker-ce-rootless-extras-20.10.8-3.el7.x86_64
--> Processing Dependency: slirp4netns >= 0.4 for package: docker-ce-rootless-extras-20.10.8-3.el7.x86_64
---> Package docker-scan-plugin.x86_64 0:0.8.0-3.el7 will be installed
--> Finished Dependency Resolution
Error: Package: containerd.io-1.3.7-3.1.el7.aarch64 (docker-ce-stable)Requires: container-selinux >= 2:2.74
Error: Package: docker-ce-rootless-extras-20.10.8-3.el7.x86_64 (docker-ce-stable)
Requires: fuse-overlayfs >= 0.7
Error: Package: docker-ce-rootless-extras-20.10.8-3.el7.x86_64 (docker-ce-stable)
Requires: slirp4netns >= 0.4
You could try using --skip-broken to work around the problem
fix step asblow:
[root@japan-tac-161-117 yum.repos.d]# yum -y install http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.107-3.el7.noarch.rpm
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
container-selinux-2.107-3.el7.noarch.rpm | 39 kB 00:00:00
Examining /var/tmp/yum-root-D77sQf/container-selinux-2.107-3.el7.noarch.rpm: 2:container-selinux-2.107-3.el7.noarch
Marking /var/tmp/yum-root-D77sQf/container-selinux-2.107-3.el7.noarch.rpm to be installed
Resolving Dependencies
[root@japan-tac-161-117 yum.repos.d]# yum -y install http://mirror.centos.org/centos/7/extras/x86_64/Packages/fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm | 54 kB 00:00:00
Examining /var/tmp/yum-root-D77sQf/fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm: fuse-overlayfs-0.7.2-6.el7_8.x86_64
Marking /var/tmp/yum-root-D77sQf/fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm to be installed
Resolving Dependencies
[root@japan-tac-161-117 yum.repos.d]# yum -y install http://mirror.centos.org/centos/7/extras/x86_64/Packages/slirp4netns-0.4.3-4.el7_8.x86_64.rpm
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
slirp4netns-0.4.3-4.el7_8.x86_64.rpm | 81 kB 00:00:00
Examining /var/tmp/yum-root-D77sQf/slirp4netns-0.4.3-4.el7_8.x86_64.rpm: slirp4netns-0.4.3-4.el7_8.x86_64
Marking /var/tmp/yum-root-D77sQf/slirp4netns-0.4.3-4.el7_8.x86_64.rpm to be installed
Resolving Dependencies
[root@japan-tac-161-117 yum.repos.d]# yum install docker-ce
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package docker-ce.x86_64 3:20.10.8-3.el7 will be installed
--> Processing Dependency: containerd.io >= 1.4.1 for package: 3:docker-ce-20.10.8-3.el7.x86_64
--> Processing Dependency: docker-ce-cli for package: 3:docker-ce-20.10.8-3.el7.x86_64
--> Processing Dependency: docker-ce-rootless-extras for package: 3:docker-ce-20.10.8-3.el7.x86_64
--> Running transaction check
---> Package containerd.io.x86_64 0:1.4.9-3.1.el7 will be installed
---> Package docker-ce-cli.x86_64 1:20.10.8-3.el7 will be installed
--> Processing Dependency: docker-scan-plugin(x86-64) for package: 1:docker-ce-cli-20.10.8-3.el7.x86_64
---> Package docker-ce-rootless-extras.x86_64 0:20.10.8-3.el7 will be installed
--> Running transaction check
---> Package docker-scan-plugin.x86_64 0:0.8.0-3.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================================================
Package Arch Version Repository Size
============================================================================================================================
Installing:
docker-ce x86_64 3:20.10.8-3.el7 docker-ce-stable 23 M
Installing for dependencies:
containerd.io x86_64 1.4.9-3.1.el7 docker-ce-stable 30 M
docker-ce-cli x86_64 1:20.10.8-3.el7 docker-ce-stable 29 M
docker-ce-rootless-extras x86_64 20.10.8-3.el7 docker-ce-stable 8.0 M
docker-scan-plugin x86_64 0.8.0-3.el7 docker-ce-stable 4.2 M
Transaction Summary
============================================================================================================================
Install 1 Package (+4 Dependent packages)
Total download size: 94 M
Installed size: 380 M
Is this ok [y/d/N]: y
[guangxil@japan-tac-161-117 ~]$ docker run hello-world
docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/create": dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.
[guangxil@japan-tac-161-117 ~]$ sudo g
Display all 241 possibilities? (y or n)
[guangxil@japan-tac-161-117 ~]$ sudo gpasswd -a guangxil docker
[sudo] password for guangxil:
Adding user guangxil to group docker
[guangxil@japan-tac-161-117 ~]$ docker run hello-world
docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/create": dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.
[guangxil@japan-tac-161-117 ~]$ exit
logout
Last login: Fri Sep 24 13:01:07 2021 from
[guangxil@japan-tac-161-117 ~]$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:393b81f0ea5a98a7335d7ad44be96fe76ca8eb2eaa
No comments:
Post a Comment