docker开机启动和docker-compose开机启动执行相应的各个docker容器

设置开机启动

1.开机启动docker

systemctl enable docker.service

2.docker-compose启动

方法一:
vim /etc/rc.d/rc.local
/usr/local/bin/docker-compose -f /www/docker/trace_fecshop/docker-compose.yml up -d

 

方法二:
复制代码
vim /etc/rc.d/init.d/start-docker-compose.sh

start-docker-compose.sh
#!/bin/bash
# chkconfig: 2345 85 15
# description: docker-compose

/usr/local/bin/docker-compose -f /www/docker/trace_fecshop/docker-compose.yml up -d
复制代码

/www/docker/trace_fecshop 是你的docker-compose的目录

posted @ 2021-12-13 16:43  陈晓猛  阅读(1991)  评论(0编辑  收藏  举报