Docker镜像管理快速入门

简介: docker

CentOS Linux release 7.9.2009 (Core)

1,yum工具安装
yum install yum-utils -y

2,配置docker镜像仓库
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

3,docker软件安装
缺少container-selinux 依赖软件包。

[root@i-AAB0CE27 yum.repos.d]# yum install docker-ce-18.03.1.ce -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
docker-ce-stable | 3.5 kB 00:00:00
(1/2): docker-ce-stable/7/x86_64/updateinfo | 55 B 00:00:00
(2/2): docker-ce-stable/7/x86_64/primary_db | 70 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package docker-ce.x86_64 0:18.03.1.ce-1.el7.centos will be installed
--> Processing Dependency: libseccomp >= 2.3 for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Processing Dependency: container-selinux >= 2.9 for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Processing Dependency: pigz for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Processing Dependency: libcgroup for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Processing Dependency: libltdl.so.7()(64bit) for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Processing Dependency: libseccomp.so.2()(64bit) for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Running transaction check
---> Package docker-ce.x86_64 0:18.03.1.ce-1.el7.centos will be installed
--> Processing Dependency: container-selinux >= 2.9 for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Processing Dependency: pigz for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
---> Package libcgroup.x86_64 0:0.41-21.el7 will be installed
---> Package libseccomp.x86_64 0:2.3.1-4.el7 will be installed
---> Package libtool-ltdl.x86_64 0:2.4.2-22.el7_3 will be installed
--> Finished Dependency Resolution
Error: Package: docker-ce-18.03.1.ce-1.el7.centos.x86_64 (docker-ce-stable)

       Requires: pigz

Error: Package: docker-ce-18.03.1.ce-1.el7.centos.x86_64 (docker-ce-stable)

       Requires: container-selinux >= 2.9

You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
[root@i-AAB0CE27 yum.repos.d]# yum install container-selinux
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
No package container-selinux available.
Error: Nothing to

4,配置依赖仓库

要不然确实container-selinux软件依赖包

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

5,docker软件安装
[root@i-AAB0CE27 yum.repos.d]# yum install docker-ce-18.03.1.ce -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

  • base: mirrors.aliyun.com
  • extras: mirrors.aliyun.com
  • updates: mirrors.aliyun.com

base/7/x86_64/primary_db | 6.1 MB 00:00:05
Resolving Dependencies
--> Running transaction check
---> Package docker-ce.x86_64 0:18.03.1.ce-1.el7.centos will be installed
--> Processing Dependency: libseccomp >= 2.3 for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Processing Dependency: container-selinux >= 2.9 for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Processing Dependency: pigz for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Processing Dependency: libcgroup for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Processing Dependency: libltdl.so.7()(64bit) for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Processing Dependency: libseccomp.so.2()(64bit) for package: docker-ce-18.03.1.ce-1.el7.centos.x86_64
--> Running transaction check
---> Package container-selinux.noarch 2:2.119.2-1.911c772.el7_8 will be installed
--> Processing Dependency: policycoreutils-python for package: 2:container-selinux-2.119.2-1.911c772.el7_8.noarch
---> Package libcgroup.x86_64 0:0.41-21.el7 will be installed
---> Package libseccomp.x86_64 0:2.3.1-4.el7 will be installed
---> Package libtool-ltdl.x86_64 0:2.4.2-22.el7_3 will be installed
---> Package pigz.x86_64 0:2.3.3-1.el7.centos will be installed
--> Running transaction check
---> Package policycoreutils-python.x86_64 0:2.5-34.el7 will be installed
--> Processing Dependency: setools-libs >= 3.3.8-4 for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libsemanage-python >= 2.5-14 for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: audit-libs-python >= 2.1.3-4 for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: python-IPy for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.4)(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.2)(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libapol.so.4(VERS_4.0)(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: checkpolicy for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libqpol.so.1()(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libapol.so.4()(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Running transaction check
---> Package audit-libs-python.x86_64 0:2.8.5-4.el7 will be installed
---> Package checkpolicy.x86_64 0:2.5-8.el7 will be installed
---> Package libsemanage-python.x86_64 0:2.5-14.el7 will be installed
---> Package python-IPy.noarch 0:0.75-6.el7 will be installed
---> Package setools-libs.x86_64 0:3.3.8-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================================

Package Arch Version Repository Size

Installing:
docker-ce x86_64 18.03.1.ce-1.el7.centos docker-ce-stable 35 M
Installing for dependencies:
audit-libs-python x86_64 2.8.5-4.el7 base 76 k
checkpolicy x86_64 2.5-8.el7 base 295 k
container-selinux noarch 2:2.119.2-1.911c772.el7_8 extras 40 k
libcgroup x86_64 0.41-21.el7 base 66 k
libseccomp x86_64 2.3.1-4.el7 base 56 k
libsemanage-python x86_64 2.5-14.el7 base 113 k
libtool-ltdl x86_64 2.4.2-22.el7_3 base 49 k
pigz x86_64 2.3.3-1.el7.centos extras 68 k
policycoreutils-python x86_64 2.5-34.el7 base 457 k
python-IPy noarch 0.75-6.el7 base 32 k
setools-libs x86_64 3.3.8-4.el7 base 620 k

Transaction Summary

Install 1 Package (+11 Dependent packages)

Total download size: 36 M
Installed size: 40 M
Downloading packages:
libcgroup-0.41-21.el7.x86_64.r FAILED
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/Packages/libcgroup-0.41-21.el7.x86_64.rpm: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com; Unknown error"
Trying other mirror.
warning: /var/cache/yum/x86_64/7/extras/packages/container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm is not installed
(1/12): container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm | 40 kB 00:00:00
Public key for audit-libs-python-2.8.5-4.el7.x86_64.rpm is not installed
(2/12): audit-libs-python-2.8.5-4.el7.x86_64.rpm | 76 kB 00:00:00
(3/12): libseccomp-2.3.1-4.el7.x86_64.rpm | 56 kB 00:00:00
(4/12): libtool-ltdl-2.4.2-22.el7_3.x86_64.rpm | 49 kB 00:00:00
(5/12): pigz-2.3.3-1.el7.centos.x86_64.rpm | 68 kB 00:00:00
(6/12): python-IPy-0.75-6.el7.noarch.rpm | 32 kB 00:00:00
(7/12): policycoreutils-python-2.5-34.el7.x86_64.rpm | 457 kB 00:00:00
(8/12): libcgroup-0.41-21.el7.x86_64.rpm | 66 kB 00:00:00
(9/12): setools-libs-3.3.8-4.el7.x86_64.rpm | 620 kB 00:00:00
checkpolicy-2.5-8.el7.x86_64.r FAILED ======================= ] 1.0 MB/s | 30 MB 00:00:05 ETA
http://mirrors.aliyuncs.com/centos/7/os/x86_64/Packages/libsemanage-python-2.5-14.el7.x86_64.rpm: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7/os/x86_64/Packages/libsemanage-python-2.5-14.el7.x86_64.rpm: (28, 'Connection timed out after 30001 milliseconds')
Trying other mirror.
(10/12): checkpolicy-2.5-8.el7.x86_64.rpm | 295 kB 00:00:00
(11/12): libsemanage-python-2.5-14.el7.x86_64.rpm | 113 kB 00:00:00
warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/docker-ce-18.03.1.ce-1.el7.centos.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
Public key for docker-ce-18.03.1.ce-1.el7.centos.x86_64.rpm is not installed

(12/12): docker-ce-18.03.1.ce-1.el7.centos.x86_64.rpm | 35 MB 00:00:35

Total 1.0 MB/s | 36 MB 00:00:35
Retrieving key from http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
From : http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
Retrieving key from https://mirrors.aliyun.com/docker-ce/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://mirrors.aliyun.com/docker-ce/linux/centos/gpg
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libcgroup-0.41-21.el7.x86_64 1/12
Installing : pigz-2.3.3-1.el7.centos.x86_64 2/12
Installing : setools-libs-3.3.8-4.el7.x86_64 3/12
Installing : audit-libs-python-2.8.5-4.el7.x86_64 4/12
Installing : libtool-ltdl-2.4.2-22.el7_3.x86_64 5/12
Installing : python-IPy-0.75-6.el7.noarch 6/12
Installing : libseccomp-2.3.1-4.el7.x86_64 7/12
Installing : libsemanage-python-2.5-14.el7.x86_64 8/12
Installing : checkpolicy-2.5-8.el7.x86_64 9/12
Installing : policycoreutils-python-2.5-34.el7.x86_64 10/12
Installing : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch 11/12
Installing : docker-ce-18.03.1.ce-1.el7.centos.x86_64 12/12
Verifying : checkpolicy-2.5-8.el7.x86_64 1/12
Verifying : docker-ce-18.03.1.ce-1.el7.centos.x86_64 2/12
Verifying : libsemanage-python-2.5-14.el7.x86_64 3/12
Verifying : libseccomp-2.3.1-4.el7.x86_64 4/12
Verifying : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch 5/12
Verifying : python-IPy-0.75-6.el7.noarch 6/12
Verifying : libtool-ltdl-2.4.2-22.el7_3.x86_64 7/12
Verifying : policycoreutils-python-2.5-34.el7.x86_64 8/12
Verifying : audit-libs-python-2.8.5-4.el7.x86_64 9/12
Verifying : setools-libs-3.3.8-4.el7.x86_64 10/12
Verifying : pigz-2.3.3-1.el7.centos.x86_64 11/12
Verifying : libcgroup-0.41-21.el7.x86_64 12/12

Installed:
docker-ce.x86_64 0:18.03.1.ce-1.el7.centos

Dependency Installed:
audit-libs-python.x86_64 0:2.8.5-4.el7 checkpolicy.x86_64 0:2.5-8.el7 container-selinux.noarch 2:2.119.2-1.911c772.el7_8
libcgroup.x86_64 0:0.41-21.el7 libseccomp.x86_64 0:2.3.1-4.el7 libsemanage-python.x86_64 0:2.5-14.el7
libtool-ltdl.x86_64 0:2.4.2-22.el7_3 pigz.x86_64 0:2.3.3-1.el7.centos policycoreutils-python.x86_64 0:2.5-34.el7
python-IPy.noarch 0:0.75-6.el7 setools-libs.x86_64 0:3.3.8-4.el7

Complete!
6,启动docker并检查版本信息
[root@i-AAB0CE27 yum.repos.d]# systemctl start docker
[root@i-AAB0CE27 yum.repos.d]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@i-AAB0CE27 yum.repos.d]# docker --version
Docker version 18.03.1-ce, build 9ee9f40

相关文章
|
13天前
|
消息中间件 Kafka 流计算
docker环境安装kafka/Flink/clickhouse镜像
通过上述步骤和示例,您可以系统地了解如何使用Docker Compose安装和配置Kafka、Flink和ClickHouse,并进行基本的验证操作。希望这些内容对您的学习和工作有所帮助。
93 28
|
1月前
|
Ubuntu NoSQL 开发工具
《docker基础篇:4.Docker镜像》包括是什么、分层的镜像、UnionFS(联合文件系统)、docker镜像的加载原理、为什么docker镜像要采用这种分层结构呢、docker镜像commit
《docker基础篇:4.Docker镜像》包括是什么、分层的镜像、UnionFS(联合文件系统)、docker镜像的加载原理、为什么docker镜像要采用这种分层结构呢、docker镜像commit
229 70
|
26天前
|
网络协议 Linux 网络安全
docker centos镜像 npm安装包时报错“npm ERR! code ECONNRESET”
通过上述步骤,您可以有效解决在 Docker 中使用 CentOS 镜像安装 npm 包时遇到的 "npm ERR! code ECONNRESET" 错误。希望这些方法能帮助您顺利进行 npm 包的安装。
122 26
|
1月前
|
存储 Docker 容器
Docker-基础(数据卷、自定义镜像、Compose)
通过数据卷实现持久化存储,通过自定义镜像满足特定需求,通过Docker Compose方便地管理多容器应用
93 27
|
1月前
|
Ubuntu NoSQL Linux
《docker基础篇:3.Docker常用命令》包括帮助启动类命令、镜像命令、有镜像才能创建容器,这是根本前提(下载一个CentOS或者ubuntu镜像演示)、容器命令、小总结
《docker基础篇:3.Docker常用命令》包括帮助启动类命令、镜像命令、有镜像才能创建容器,这是根本前提(下载一个CentOS或者ubuntu镜像演示)、容器命令、小总结
182 6
《docker基础篇:3.Docker常用命令》包括帮助启动类命令、镜像命令、有镜像才能创建容器,这是根本前提(下载一个CentOS或者ubuntu镜像演示)、容器命令、小总结
|
1月前
|
存储 Docker 容器
Docker-基础(数据卷、自定义镜像、Compose)
通过数据卷实现持久化存储,通过自定义镜像满足特定需求,通过Docker Compose方便地管理多容器应用。掌握这些Docker基础概念和操作,可以显著提高开发和部署效率,确保应用程序的可移植性和可扩展性。
80 22
|
1月前
|
Ubuntu NoSQL 关系型数据库
《docker基础篇:6.本地镜像发布到私有库》包括本地镜像发布到私有库流程、docker regisry是什么、将本地镜像推送到私有库
《docker基础篇:6.本地镜像发布到私有库》包括本地镜像发布到私有库流程、docker regisry是什么、将本地镜像推送到私有库
136 29
|
2月前
|
Docker 容器
将本地的应用程序打包成Docker镜像
将本地的应用程序打包成Docker镜像
|
2月前
|
NoSQL PHP MongoDB
docker push推送自己搭建的镜像
本文详细介绍了如何搭建和复盘两个Web安全挑战环境:人力资源管理系统和邮件管理系统。首先,通过Docker搭建MongoDB和PHP环境,模拟人力资源管理系统的漏洞,包括nosql注入和文件写入等。接着,复盘了如何利用这些漏洞获取flag。邮件管理系统部分,通过目录遍历、文件恢复和字符串比较等技术,逐步绕过验证并最终获取flag。文章提供了详细的步骤和代码示例,适合安全研究人员学习和实践。
76 3
docker push推送自己搭建的镜像
|
2月前
|
Docker 容器