Day02docker学习-2 ,podman
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Day02docker学习-2 ,podman相关的知识,希望对你有一定的参考价值。
1.almaLinux系统安装
见:https://blog.51cto.com/u_15506674/5857852
2.almaLinux使用podman容器安装centos7.9
过程解析类似docker安装centos7.9略过
2.1下载镜像,启动容器,登入容器
[root@192 ~]# podman pull centos:centos7.9.2009
Resolved "centos" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull quay.io/centos/centos:centos7.9.2009...
Getting image source signatures
Copying blob 2d473b07cdd5 done
Copying config 8652b9f0cb done
Writing manifest to image destination
Storing signatures
8652b9f0cb4c0599575e5a003f5906876e10c1ceb2ab9fe1786712dac14a50cf
[root@192 ~]# podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
quay.io/centos/centos centos7.9.2009 8652b9f0cb4c 23 months ago 212 MB
[root@192 ~]# podman run -itd 8652b9f0cb4c /bin/bash
791b073795ba3dc4a74872774354f06947e53ad21da5ea6e3a65f8df597a3946
[root@192 ~]# podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
791b073795ba quay.io/centos/centos:centos7.9.2009 /bin/bash 17 seconds ago Up 11 seconds ago nostalgic_stonebraker
[root@192 ~]# podman exec -it 791b073795ba /bin/bash
[root@791b073795ba /]# ls
anaconda-post.log bin dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
[root@791b073795ba /]#
2.3设置端口映射,设置密码,建立Xshell远程
[root@791b073795ba /]# exit
exit
[root@192 ~]# podman rm -f 791b073795ba
WARN[0010] StopSignal SIGTERM failed to stop container nostalgic_stonebraker in 10 seconds, resorting to SIGKILL
791b073795ba3dc4a74872774354f06947e53ad21da5ea6e3a65f8df597a3946
[root@192 ~]# podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@192 ~]# podman run -itd --name=centos -p 5000:22 8652b9f0cb4c /bin/bash
5402cc8caced8598a39121db98673d70b5ce947bd085feb212695d1c49048723
[root@192 ~]# podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5402cc8caced quay.io/centos/centos:centos7.9.2009 /bin/bash 55 seconds ago Up 54 seconds ago 0.0.0.0:5000->22/tcp centos
[root@192 ~]# podman exec -it centos /bin/bash
[root@5402cc8caced /]# yum install -y openssh*
[root@5402cc8caced /]# rpm -qa |grep -E "openssh"
openssh-askpass-7.4p1-22.el7_9.x86_64
openssh-server-sysvinit-7.4p1-22.el7_9.x86_64
openssh-ldap-7.4p1-22.el7_9.x86_64
openssh-7.4p1-22.el7_9.x86_64
openssh-cavs-7.4p1-22.el7_9.x86_64
openssh-clients-7.4p1-22.el7_9.x86_64
openssh-keycat-7.4p1-22.el7_9.x86_64
openssh-server-7.4p1-22.el7_9.x86_64
[root@5402cc8caced /]# whoami
root
[root@5402cc8caced /]# echo 12345678|passwd --stdin root
Changing password for user root.
passwd: all authentication tokens updated successfully.
[root@5402cc8caced /]#
启动sshd, 失败
systemctl start sshd
安装 initscripts
yum install initscripts
重启sshd服务
service sshd restart
#systemctl start sshd
Xshell连接
以上是关于Day02docker学习-2 ,podman的主要内容,如果未能解决你的问题,请参考以下文章
Docker学习总结(65)—— 容器引擎 Docker 与 Podman 的详细对比分析