podman容器
<h2>安装podman容器</h2>
<p>centos8安装
dnf module install -y container-tools</p>
<p>centos7安装
yum install install -y podman</p>
<p>配置国内加速源
mv /etc/containers/registries.conf /etc/containers/registries.conf.bak
vim /etc/containers/registries.conf</p>
<p>unqualified-search-registries = [“docker.io”]
[[registry]]
prefix = “docker.io”
location = “rncxm540.mirror.aliyuncs.com”location = “rncxm540.mirror.aliyuncs.com”</p>
<h2>常用命令</h2>
<p>搜索centos镜像
podman search centos</p>
<p>拉取镜像
podman pull centos:7.6.1810</p>
<p>查看容器镜像
podman images</p>
<p>run 创建一个容器 -d 后台运行 -p 映射端口 注:(—) 是两个横杠
podman run -d -p主机端口:容器端口 —name=容器名 -v主机目录:容器目录 —privileged=true centos:7.6.1810 /usr/sbin/init</p>
<p>查看所有容器
podman ps -a</p>
<p>进入一个容器 exit退出
podman exec -it 容器名 /bin/bash</p>
<p>删除容器 -f强制删除 -a未运行的容器
podman rm 容器名</p>
<p>删除镜像 -f强制删除
podman rmi 镜像名</p>
<p>重启,关闭,启动容器
podman restart/stop/start 容器名</p>
<h2>导出导出容器镜像</h2>
<p>导出镜像
podman save -o 保存路径.tar 镜像名称:标签
podman commit 容器ID 镜像名称:标签</p>
<p>导入镜像
podman load —input ./镜像名称 镜像名称:标签
podman load < 镜像名</p>
<p>导出容器
podman export 容器名 > 保存路径</p>
<p>导入容器
podman import 文件路径 容器名</p>