【容器】Podman和常用命令
Podman常用命令
(摘自:Podman常用命令总结_假面生的博客-CSDN博客_podman命令
容器
podman ps/podman ps -a 查看容器
podman run pod id/pod name 创建并启动容器podman run --name build-env image.cestc.cn/ccos-ceastor/dind-build-env:test /sbin/init&
podman start pod id/pod name 启动容器
podman stop pod id/pod name 终止容器 podman stop build-env
podman restart pod id/pod name 重启容器 podman restart build-env
podman attach pod id/pod name 进入容器
podman exec pod id/pod name 进入容器 podman exec -it build-env bash
podman export pod id/pod name 导出容器
podman import pod id/pod name 导入容器快照
podman rm pod id/pod name 删除容器 podman rm build-env
podman logs pod id/pod name 查看日志
镜像
podman search 检索镜像
podman pull 获取镜像
podman images 列出镜像
podman image Is 列出镜像
podman rmi 删除镜像
podman image rm 删除镜像
podman save 导出镜像
podman load 导入镜像
podmanfile 定制镜像(三个)
podman build 构建镜像
podman run 运行镜像
podmanfile 常用指令(四个)
COPY 复制文件
ADD 高级复制
CMD 容器启动命令
ENV 环境变量
EXPOSE 暴露端口
部署 Podman
//安装podman
[root@localhost ~]# yum -y install podman
Podman 加速器
vim /etc/containers/registries.conf
#unqualified-search-registries = ["registry.fedoraproject.org", "registry.access.redhat.com", "registry.centos.org", "docker.io"]
unqualified-search-registries = ["docker.io"]
[[registry]]
prefix = "docker.io"
location = "ay24c8ru.mirror.aliyuncs.com"
创建镜像容器
[root@localhost containers]# podman run -d --name web -p 8080:80 httpd
[root@localhost containers]# podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d92bc2ac42cd docker.io/library/httpd:latest httpd-foreground 11 seconds ago Up 10
浙公网安备 33010602011771号