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 @ 2018-12-16 14:17  chismi  阅读(10961)  评论(0编辑  收藏  举报