Última atividade 1724897923

Revisão 722f477511e779071b5c73fcfdbbecef01bf105f

docker-compose Bruto
1根据需要进行设置
2$ /etc/systemd/system/
3$ vim ./docker-compose-app.service
4
5
6```bash 
7[Unit]
8Description=Docker Compose Application Service
9Requires=/snap/bin/docker-compose
10After=/snap/bin/docker-compose
11
12[Service]
13Type=oneshot
14RemainAfterExit=yes
15WorkingDirectory=/home/rdf/Desktop
16ExecStart=/snap/bin/docker-compose up -d
17ExecStop=/snap/bin/docker-compose down
18TimeoutStartSec=0
19
20[Install]
21WantedBy=multi-user.target
22```
23
24服务拷贝(如有需要,将该服务单元文件移动到/etc/systemd/system/目录中)
25sudo mv docker-compose.service /etc/systemd/system/
26
27刷新systemd服务配置:
28$ sudo systemctl daemon-reload
29
30启用并启动该服务:
31sudo systemctl enable docker-compose.service
32sudo systemctl start docker-compose.service
33
34当系统启动时,Docker Compose将自动启动您的应用程序容器
35
36打印docker-compose的程序路径
37which docker-compose