我們對于docker-compose并不陌生,它是一個用于編排多個可能相互依賴的容器的工具。
而Podman Compose項目的目標(biāo)是作為 docker-ompose 的替代品,而不需要對 docker-compose.yaml 文件進行任何修改。
要想使用podman-compose需要先安裝podman,然后安裝podman-compose。
Rocky8下安裝podman:
yum install -y podman
Rocky8下安裝podman-compose,因為podman-compose是基于python開發(fā),可以使用pip來安裝:
pip3 install podman-compose
示例:使用podman-compose部署wordpress
編輯docker-compose.yml文件,內(nèi)容如下
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 ##添加如下內(nèi)容 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一樣。
審核編輯:湯梓紅
-
容器
+關(guān)注
關(guān)注
0文章
492瀏覽量
22027 -
Docker
+關(guān)注
關(guān)注
0文章
453瀏覽量
11792 -
wordpress
+關(guān)注
關(guān)注
0文章
34瀏覽量
2859
原文標(biāo)題:使用podman-compose快速部署應(yīng)用
文章出處:【微信號:aming_linux,微信公眾號:阿銘linux】歡迎添加關(guān)注!文章轉(zhuǎn)載請注明出處。
發(fā)布評論請先 登錄
相關(guān)推薦
評論