[qzl@localhost~]$ podman run -d --name nginx1 docker.io/library/nginx:latest 982dd9e04ed6b35b0a03da43572b964cf2808e709f24ff1c0030d783d66ec319
[qzl@localhost~]$ podman ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
982dd9e04ed6 docker.io/library/nginx:latest nginx -g daemon o...7 seconds ago Up 7 seconds ago nginx1
生成配置文件
[qzl@localhost~]$ mkdir -p .config/systemd/sb
[qzl@localhost~]$ cd .config/systemd/sb/[qzl@localhost sb]$ podman generate systemd --files --name nginx
Error: nginx does not refer to a container or pod: no pod with name or ID nginx found: no such pod: no container with name or ID "nginx" found: no such container
[qzl@localhost sb]$ podman generate systemd --files --name nginx1/home/qzl/.config/systemd/sb/container-nginx1.service
[qzl@localhost sb]$ cat container-nginx.service
cat: container-nginx.service: 没有那个文件或目录
[qzl@localhost sb]$ cat container-nginx1.service
# container-nginx1.service# autogenerated by Podman 4.0.2# Sun May 15 10:10:14 EDT 2022[Unit]
Description=Podman container-nginx1.service
Documentation=man:podman-generate-systemd(1)
Wants=network-online.target
远程连接用户
[root@localhost~]# ssh qzl@localhost
The authenticity of host 'localhost (::1)' can't be established.
ECDSA key fingerprint is SHA256:4k3Xw2Wq78GjEDbAJyNZOri0sZHwO8nvISMqanvR994.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
qzl@localhost's password:
Activate the web console with: systemctl enable--now cockpit.socketLast login: Sun May 1510:05:122022
设置开机自启动
[qzl@localhost sb]$ systemctl --user enable --now container-nginx1.service
Created symlink /home/shuaige/.config/systemd/user/multi-user.target.wants/container-nginx.service → /home/shuaige/.config/systemd/sb/container-nginx.service.
Created symlink /home/shuaige/.config/systemd/user/default.target.wants/container-nginx.service → /home/shuaige/.config/systemd/sb/container-nginx.service.[shuaige@localhost sb]$ systemctl --user status container-nginx.service
● container-nginx.service - Podman container-nginx.service
Loaded: loaded (/home/shuaige/.config/systemd/sb/container-nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-12-1507:25:24 EST;3min 24s ago
Docs: man:podman-generate-systemd(1)
Main PID: 7978(conmon)
CGroup: /user.slice/user-1000.slice/user@1000.service/container-nginx.service
├─7972/usr/bin/slirp4netns --disable-host-loopback --mtu=65520 --enable-sandbox --enable-seccomp -c -e 3 -r 4 --netns>
├─7975/usr/bin/fuse-overlayfs -o ,lowerdir=/home/shuaige/.local/share/containers/storage/overlay/l/UBB5BCEQLHQ2G7RFOR>
├─7978/usr/bin/conmon --api-version 1 -c 7ed9063a90a9c3b48096ee8fcec60e799c6103fb8fe8ae9226bf8e7d5eee1591 -u 7ed9063a>
├─7981 nginx: master process nginx -g daemon off;
└─8000 nginx: worker process
lines1-11/11(END)