[root@cxr ~]# podman pull busybox
Resolved "busybox" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull docker.io/library/busybox:latest...
Getting image source signatures
Copying blob 5cc84ad355aa done
Copying config beae173cca done
Writing manifest to image destination
Storing signatures
beae173ccac6ad749f76713cf4440fe3d21d1043fe616dfbe30775815d1d0f6a
[root@cxr ~]# podman run --name test -dit docker.io/library/busybox
WARN[0000] Ignoring global metacopy option, not supported with booted kernel
5a27696f3351fa9a80b81c1d7c90aa781eddbc47774340baa241572f6070ae87
[root@cxr ~]# podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
388bf8e619a0 docker.io/library/nginx:latest nginx -g daemon o... 53 minutes ago Up 53 minutes ago 0.0.0.0:8080->80/tcp web
5a27696f3351 docker.io/library/busybox:latest sh 28 seconds ago Up 28 seconds ago test
[root@cxr ~]# podman generate systemd --files --name test
/root/container-test.service
[root@cxr ~]# podman generate systemd --files --name test --new
/root/container-test.service
[root@cxr ~]# mv container-test.service /usr/lib/systemd/system/
[root@cxr ~]# systemctl daemon-reload
[root@cxr ~]# setenforce 0
[root@cxr ~]# vim /etc/selinux/config
SELINUX=disabled
[root@cxr ~]# systemctl enable --now container-test.service
Created symlink /etc/systemd/system/default.target.wants/container-test.service → /usr/lib/systemd/system/container-test.service.
[root@cxr ~]# reboot
连接断开
连接成功
Activate the web console with: systemctl enable --now cockpit.socket
Last login: Tue May 10 02:52:36 2022 from 192.168.106.1
[root@cxr ~]# podman ps //可以看到已经开机自启了
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f56bd4002398 docker.io/library/busybox:latest sh 9 seconds ago Up 7 seconds ago test