栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

podman容器的开机自启

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

podman容器的开机自启

  • podman容器的开机自启
[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

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/882562.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号