《OpenShift 4.x HOL教程汇总》
已在 RHEL 8.4 上验证
本文的前置条件:RHEL8 - 配置基于安装 ISO 文件的 YUM Repo
$ yum install -y podman
$ podman version
Version: 3.0.2-dev
API Version: 3.0.0
Go Version: go1.15.7
Built: Wed Apr 7 04:36:54 2021
OS/Arch: linux/amd64
$ yum install -y python3
$ pip3 install podman-compose
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting podman-compose
Downloading https://files.pythonhosted.org/packages/d8/1a/4eed53406776275302a9325555a3c389c7ad8fa35ab287e6d93c041b7de7/podman_compose-0.1.5-py2.py3-none-any.whl
Collecting pyyaml (from podman-compose)
Downloading https://files.pythonhosted.org/packages/7a/5b/bc0b5ab38247bba158504a410112b6c03f153c652734ece1849749e5f518/PyYAML-5.4.1-cp36-cp36m-manylinux1_x86_64.whl (640kB)
100% |████████████████████████████████| 645kB 744kB/s
Installing collected packages: pyyaml, podman-compose
Successfully installed podman-compose-0.1.5 pyyaml-5.4.1
$ yum install -y git
$ git clone https://github.com/liuxiaoyu-git/podman-compose
$ cd podman-compose/examples/busybox/
$ more docker-compose.yaml
$ podman-compose -f podman-compose/examples/busybox/docker-compose.yaml up -d
podman pod create --name=busybox --share net -p 6379 -p 8080
f7b4df2a88fe52fc5c9415a06dddf8e40369e04405d2e1d19e0e3bb3a74df103
0
podman create --name=busybox_redis_1 --pod=busybox -l io.podman.compose.config-hash=123 -l io.podman.compose.project=busybox -l io.podman.compose.version=0.0.1 -l com.docker.compose.container-number=1 -l com.docker.compose.service=redis -e SECRET_KEY=aabbcc -e ENV_IS_SET --add-host redis:127.0.0.1 --add-host busybox_redis_1:127.0.0.1 --add-host frontend:127.0.0.1 --add-host busybox_frontend_1:127.0.0.1 redis:alpine
✔ docker.io/library/redis:alpine
Trying to pull docker.io/library/redis:alpine...
Getting image source signatures
Copying blob 6ab1d05b4973 done
Copying blob 8cc52074f78e done
Copying blob aa7854465cce done
Copying blob 540db60ca938 done
Copying blob 8173c12df40f done
Copying blob 29712d301e8c done
Copying config 1690b63e20 done
Writing manifest to image destination
Storing signatures
d8610a268ed6993f49a1e10a736a3d13c838df66d8c580d8bce617a212e672e3
0
podman create --name=busybox_frontend_1 --pod=busybox -l my.label=my_value -l io.podman.compose.config-hash=123 -l io.podman.compose.project=busybox -l io.podman.compose.version=0.0.1 -l com.docker.compose.container-number=1 -l com.docker.compose.service=frontend -e SECRET_KEY2=aabbcc -e ENV_IS_SET2 --add-host redis:127.0.0.1 --add-host busybox_redis_1:127.0.0.1 --add-host frontend:127.0.0.1 --add-host busybox_frontend_1:127.0.0.1 --add-host myredis:127.0.0.1 -w / busybox /bin/busybox httpd -f -p 8080
✔ docker.io/library/busybox:latest
Trying to pull docker.io/library/busybox:latest...
Getting image source signatures
Copying blob b71f96345d44 done
Copying config 69593048aa done
Writing manifest to image destination
Storing signatures
754be0a0b1e038606883a53f3016a4c6a8f986775efe22cbb949626b4073321d
0
$ podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8dfecf911dca k8s.gcr.io/pause:3.2 47 seconds ago Up 27 seconds ago 0.0.0.0:43967->6379/tcp, 0.0.0.0:37103->8080/tcp f7b4df2a88fe-infra
d8610a268ed6 docker.io/library/redis:alpine redis-server 37 seconds ago Up 27 seconds ago 0.0.0.0:43967->6379/tcp, 0.0.0.0:37103->8080/tcp busybox_redis_1
754be0a0b1e0 docker.io/library/busybox:latest /bin/busybox http... 28 seconds ago Up 26 seconds ago 0.0.0.0:43967->6379/tcp, 0.0.0.0:37103->8080/tcp busybox_frontend_1
$ podman-compose -f podman-compose/examples/busybox/docker-compose.yaml down
podman stop -t=1 busybox_redis_1
8f865afa6bd3b150d2998964109da975f1e52b0e7bf5927b84e157d4a108599e
0
podman stop -t=1 busybox_frontend_1
5f739d47684e0c42f86dfaa9bf9821e4c6b31891ea9fba866ccf31209e032812
0
podman rm busybox_redis_1
8f865afa6bd3b150d2998964109da975f1e52b0e7bf5927b84e157d4a108599e
0
podman rm busybox_frontend_1
5f739d47684e0c42f86dfaa9bf9821e4c6b31891ea9fba866ccf31209e032812
0
podman pod rm busybox
deb3c036e83b4fd4cf46e0a5b1edfcb309893a459e0a471762bf40804a6ebe32
0
$ podman ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
$ podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/library/busybox latest 69593048aa3a 15 hours ago 1.46 MB
docker.io/library/redis alpine 1690b63e207f 6 days ago 33.5 MB
k8s.gcr.io/pause 3.2 80d28bedfe5d 15 months ago 688 kB
$ podman-compose -f podman-compose/examples/awx3/docker-compose.yaml up -d
$ podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
53473a27f589 k8s.gcr.io/pause:3.2 19 seconds ago Up 18 seconds ago 0.0.0.0:8080->8052/tcp a855751ad2dc-infra
4cfce5d78231 docker.io/library/postgres:9.6 postgres 18 seconds ago Up 18 seconds ago 0.0.0.0:8080->8052/tcp awx3_postgres_1
bbea2481b803 docker.io/library/rabbitmq:3 rabbitmq-server 16 seconds ago Up 16 seconds ago 0.0.0.0:8080->8052/tcp awx3_rabbitmq_1
f6691fc9ce41 docker.io/library/memcached:alpine memcached 14 seconds ago Up 15 seconds ago 0.0.0.0:8080->8052/tcp awx3_memcached_1
6be1a4f9951c docker.io/ansible/awx_web:3.0.1 /bin/sh -c /usr/b... 13 seconds ago Up 13 seconds ago 0.0.0.0:8080->8052/tcp awx3_awx_web_1
23a38a382e02 docker.io/ansible/awx_task:3.0.1 /bin/sh -c /usr/b... 11 seconds ago Up 11 seconds ago 0.0.0.0:8080->8052/tcp awx3_awx_task_1
$ podman-compose -f podman-compose/examples/awx3/docker-compose.yaml up -d
podman stop -t=1 awx3_postgres_1
dd48e946fd3e742f10aab831f4ae0436d0cd4fd9d300e5d068077325b5c2c6e3
0
podman stop -t=1 awx3_rabbitmq_1
5472d1006c45466abf7bbfe97da4d50c53a559920585f29831c7945bb1c3b843
0
podman stop -t=1 awx3_memcached_1
9239855e91113a3ff45e70affd8783c4f897524f9a7a6ec2d62e00fe2c09e8a4
0
podman stop -t=1 awx3_awx_web_1
83739ed5211d5e61199c894c6be2142646a1ae7889a7d6c03353622ad707f092
0
podman stop -t=1 awx3_awx_task_1
99ae2208d01afcd0a0797cf3ff8fa236c40d05d39a04762379fb56d3fc86256f
0
podman rm awx3_postgres_1
dd48e946fd3e742f10aab831f4ae0436d0cd4fd9d300e5d068077325b5c2c6e3
0
podman rm awx3_rabbitmq_1
5472d1006c45466abf7bbfe97da4d50c53a559920585f29831c7945bb1c3b843
0
podman rm awx3_memcached_1
9239855e91113a3ff45e70affd8783c4f897524f9a7a6ec2d62e00fe2c09e8a4
0
podman rm awx3_awx_web_1
83739ed5211d5e61199c894c6be2142646a1ae7889a7d6c03353622ad707f092
0
podman rm awx3_awx_task_1
99ae2208d01afcd0a0797cf3ff8fa236c40d05d39a04762379fb56d3fc86256f
0
podman pod rm awx3
0e2ef02854220a446f63b1b80572ffe10135c59f927829a8e475a76893049645
0