我们对于docker-compose并不陌生,它是一个用于编排多个可能相互依赖的容器的工具。
而Podman Compose项目的目标是作为 docker-ompose 的替代品,而不需要对 docker-compose.yaml 文件进行任何修改。
要想使用podman-compose需要先安装podman,然后安装podman-compose。
Rocky8下安装podman:
yum install -y podman
Rocky8下安装podman-compose,因为podman-compose是基于python开发,可以使用pip来安装:
pip3 install podman-compose
示例:使用podman-compose部署wordpress
编辑docker-compose.yml文件,内容如下
version: "3.8" services: web: image: wordpress restart: always volumes: - wordpress:/var/www/html ports: - 8080:80 environment: WORDPRESS_DB_HOST: db WORDPRESS_DB_USER: magazine WORDPRESS_DB_NAME: magazine WORDPRESS_DB_PASSWORD: 1maGazine! WORDPRESS_TABLE_PREFIX: cz WORDPRESS_DEBUG: 0 depends_on: - db networks: - wpnet db: image: mariadb:10.5 restart: always ports: - 6603:3306 volumes: - wpdbvol:/var/lib/mysql environment: MYSQL_DATABASE: magazine MYSQL_USER: magazine MYSQL_PASSWORD: 1maGazine! MYSQL_ROOT_PASSWORD: 1maGazine! networks: - wpnet volumes: wordpress: {} wpdbvol: {} networks: wpnet: {}
为了让podman拉取镜像更快,先给它配置个加速器
#mv/etc/containers/registries.conf/etc/containers/registries.conf.bak # vi /etc/containers/registries.conf ##添加如下内容 unqualified-search-registries = ["docker.io"] [[registry]] prefix = "docker.io" location = "docker.io" [[registry.mirror]] location = "hub-mirror.c.163.com" [[registry.mirror]] location = "mirror.baidubce.com" [[registry.mirror]] location = "f1361db2.m.daocloud.io" [[registry.mirror]] location = "ustc-edu-cn.mirror.aliyuncs.com" [[registry.mirror]] location = "ghcr.io"
然后就可以启动wordpress容器啦:
# podman-compose up -d
用起来其实跟docker-compose一样。
审核编辑:汤梓红
-
容器
+关注
关注
0文章
495浏览量
22061 -
Docker
+关注
关注
0文章
458浏览量
11853 -
wordpress
+关注
关注
0文章
34浏览量
2877
原文标题:使用podman-compose快速部署应用
文章出处:【微信号:aming_linux,微信公众号:阿铭linux】欢迎添加关注!文章转载请注明出处。
发布评论请先 登录
相关推荐
评论