查看本地镜像仓库
[root@docker ~]
REPOSITORY TAG IMAGE ID CREATED SIZE
centos 6.10 f1af727749c4 4 weeks ago 194MB
centos 7 eeb6ee3f44bd 4 weeks ago 204MB
centos latest 5d0da3dc9764 4 weeks ago 231MB
nginx 1.14 295c7be07902 2 years ago 109MB
ubuntu 15.10 9b9cb95443b5 5 years ago 137MB
使用CentOS7镜像启动容器
[root@docker ~]
[root@cf6418a83218 /]
CentOS Linux release 7.9.2009 (Core)
[root@cf6418a83218 /]
CentOS-CR.repo CentOS-Media.repo CentOS-Vault.repo CentOS-x86_64-kernel.repo
[root@cf6418a83218 yum.repos.d]
[root@cf6418a83218 yum.repos.d]
[root@cf6418a83218 yum.repos.d]
[local]
name = linuxbase
baseurl = ftp://192.168.88.101/centos7
gpgcheck = 0
enabled = 1
[root@cf6418a83218 yum.repos.d]
[root@cf6418a83218 yum.repos.d]
[root@cf6418a83218 yum.repos.d]
[root@cf6418a83218 yum.repos.d]
[root@cf6418a83218 yum.repos.d]
[root@cf6418a83218 yum.repos.d]
[root@cf6418a83218 yum.repos.d]
ssh-keygen: generating new host keys: RSA1 RSA DSA ECDSA ED25519
制作第一版镜像
[root@docker ~]
sha256:356d2ac088cefd18805914e69e07821fa6b98ae423b30f9ca776fadbc54d26c4
[root@docker ~]
REPOSITORY TAG IMAGE ID CREATED SIZE
tye/centos7_sshd v1 356d2ac088ce 17 seconds ago 285MB
centos 6.10 f1af727749c4 4 weeks ago 194MB
centos 7 eeb6ee3f44bd 4 weeks ago 204MB
centos latest 5d0da3dc9764 4 weeks ago 231MB
nginx 1.14 295c7be07902 2 years ago 109MB
ubuntu 15.10 9b9cb95443b5 5 years ago 137MB
通过新创建的镜像启动一个容器实例
[root@docker ~]
3c9429c6574c66054a48e006112b03a650d7b2dbdadebac65dee38981356af50
[root@docker ~]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3c9429c6574c tye/centos7_sshd:v1 "/usr/sbin/sshd -D" 4 seconds ago Up 3 seconds 0.0.0.0:2222->22/tcp, :::2222->22/tcp centos7_sshd_new
通过ssh连接测试
[C:\~]$ ssh 192.168.88.101 2222
Connecting to 192.168.88.101:2222...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
WARNING! The remote SSH server rejected X11 forwarding request.
[root@3c9429c6574c ~]
|