Docker Stack
Compose 스타일 정의를 Swarm service 집합으로 배포하는 docker stack 그룹.
Summary
- standalone Compose와 달리 Swarm scheduler 위에 서비스와 네트워크를 배포한다.
stack deploy는docker compose up의 직접 대체가 아니라 Swarm용 배포 경로다.- 여러 service를 묶은 앱 단위를 stack 이름으로 관리한다.
Usage
docker stack COMMAND
Command Groups
deploy: 새 stack 배포 또는 업데이트- 주요 옵션:
-c,–compose-file,–prune,–resolve-image,–with-registry-auth,–detach
ls: stack 목록 조회- 주요 옵션:
–format
services: 특정 stack의 service 목록- 주요 옵션:
–filter,–format,-q
ps: stack task 목록- 주요 옵션:
–filter,–format,–no-resolve,–no-trunc
config: merge와 interpolation 후 최종 config 출력rm: stack 제거
Examples
# Swarm stack 배포 docker stack deploy -c compose.yaml myapp # registry auth를 worker 노드에 전달 docker stack deploy -c compose.yaml --with-registry-auth myapp # task 상태 확인 docker stack ps myapp
Troubleshooting
docker compose에서 동작하던 옵션 일부가 Swarmdeploy문맥에서는 다르게 해석되거나 무시될 수 있다.- private registry 이미지를 쓰면
–with-registry-auth필요 여부를 확인한다. deploy섹션은 Swarm에서만 의미가 크며, standalone Compose에서는 무시되는 값이 많다.
Help
Usage: docker stack COMMAND Manage Swarm stacks Commands: config Outputs the final config file, after doing merges and interpolations deploy Deploy a new stack or update an existing stack ls List stacks ps List the tasks in the stack rm Remove one or more stacks services List the services in the stack Run 'docker stack COMMAND --help' for more information on a command.
+
See Also
History
- codex:: 2026-07-06 Added docker stack subpage covering Swarm deployment and compose-file differences.