docker-compose를 통해 일부 서비스를 실행하고 systemd를 사용하여 시작합니다.
$ systemctl status nextcloud.service
● nextcloud.service - HomelabOS nextcloud Service
Loaded: loaded (/etc/systemd/system/nextcloud.service; enabled; vendor preset: disabled)
Active: deactivating (stop-sigterm) since Wed 2021-12-08 23:49:07 EST; 5min ago
Process: 402260 ExecStop=/usr/bin/docker-compose -f /var/homelabos/docker-compose.nextcloud.yml -p nextcloud stop (code=exited, status=0/SUCCES>
Main PID: 3128 (docker-compose)
Tasks: 22 (limit: 38376)
Memory: 12.8M
CPU: 8.704s
CGroup: /system.slice/nextcloud.service
└─3128 /usr/bin/docker-compose -f /var/homelabos/docker-compose.nextcloud.yml -p nextcloud up --build
...
보시다시피 컨테이너가 성공적으로 종료되었으며 다른 명령에서도 동일한 메시지가 표시됩니다.
$ sudo /usr/bin/docker-compose -f /var/homelabos/docker-compose.nextcloud.yml -p nextcloud ps
NAME COMMAND SERVICE STATUS PORTS
nextcloud-nextcloud-1 "/entrypoint.sh /usr…" nextcloud exited (137)
nextcloud-nextcloud_db-1 "docker-entrypoint.s…" nextcloud_db exited (0)
$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
363f0b6c5e24 grafana/grafana "/run.sh" 2 minutes ago Up 2 minutes 3000/tcp grafana-grafana-1
여기서 문제는 docker-compose up
여전히 실행 중이라는 것입니다! 이 작업을 중지하고 관리하는 컨테이너가 중지될 때, 즉 원래 동작을 중지하려면 어떻게 해야 합니까?
답변1
이는 docker compose v2.2.0의 버그입니다.v2.1.1로 다운그레이드하면 문제가 해결됩니다.