[root@localhost ~]# podman run -itd --rm --name test1 docker.io/library/busybox[root@localhost ~]# podman run -itd --rm --name test2 docker.io/library/busybox[root@localhost ~]# podman run -itd --rm --name test3 docker.io/library/busybox[root@localhost ~]# podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
55c8eb032e0e docker.io/library/busybox:latest sh27 seconds ago Up 27 seconds ago test1
d05f4d4014e8 docker.io/library/busybox:latest sh12 seconds ago Up 13 seconds ago test2
d37c16cd8249 docker.io/library/busybox:latest sh7 seconds ago Up 7 seconds ago test3
2.创建service文件
[root@localhost ~]# cd /usr/lib/systemd/system[root@localhost system]# vim podman-container1.service###podman-container1.service###[Unit]Description=Podman container1
[Service]Type=simple
ExecStart=/usr/bin/podman start -a test1
ExecStop=/usr/bin/podman stop -t 10 test1
[Install]WantedBy=multi-user.target
[root@localhost system]# vim podman-container2.service###podman-container2.service###[Unit]Description=Podman container2
After=network.target
After=network-online.target
After=podman-container1.service
[Service]Type=simple
ExecStart=/usr/bin/podman start -a test2
ExecStop=/usr/bin/podman stop -t 20 test2
[Install]WantedBy=multi-user.target
[root@localhost system]# vim podman-container3.service###podman-container3.service###[Unit]Description=Podman container3
After=network.target
After=network-online.target
After=podman-container2.service
[Service]Type=simple
ExecStart=/usr/bin/podman start -a test3
ExecStop=/usr/bin/podman stop -t 22 test3
[Install]WantedBy=multi-user.target
[root@localhost ~]# podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
55c8eb032e0e docker.io/library/busybox:latest sh4 minutes ago Up 25 seconds ago test1
d05f4d4014e8 docker.io/library/busybox:latest sh4 minutes ago Up 25 seconds ago test2
d37c16cd8249 docker.io/library/busybox:latest sh4 minutes ago Up 25 seconds ago test3