$ docker info
------------------------------------------------------------------
...
Swarm: inactive
...
-------------------------------------------------------------------
비활성화 상태임.
$ docker swarm --help
-------------------------------------------------------------------
Usage: docker swarm COMMAND
Manage Swarm
Commands:
ca Display and rotate the root CA
init Initialize a swarm
join Join a swarm as a node and/or manager
join-token Manage join tokens
leave Leave the swarm
unlock Unlock swarm
unlock-key Manage the unlock key
update Update the swarm
-------------------------------------------------------------------
[example]
$ docker swarm init
-----------------------------------------------------------------------------------
Swarm initialized: current node (xuoisgtch2ht3ija12rv6jo39) is now a manager.
-----------------------------------------------------------------------------------
$ docker swarm join-token manager
$ docker swarm join-token worker
$ docker node --help
-------------------------------------------------------------------
Usage: docker node COMMAND
Manage Swarm nodes
Commands:
demote Demote one or more nodes from manager in the swarm
inspect Display detailed information on one or more nodes
ls List nodes in the swarm
promote Promote one or more nodes to manager in the swarm
ps List tasks running on one or more nodes, defaults to current node
rm Remove one or more nodes from the swarm
update Update a node
-------------------------------------------------------------------
[example]
$ docker node ls --> Entire list
--------------------------------------------------------------------------------------------
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION
xuoisgtch2ht3ija12rv6jo39 * ip-172-31-28-47 Ready Active Leader 18.09.5
--------------------------------------------------------------------------------------------
$ docker node ps --> Current Executing list
--------------------------------------------------------------------------------------------
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
lp6c58slnydn test_nginx.1 nginx:latest ip-172-31-28-47 Running Running 32 minutes ago
r97y6j7h6g7v test_nginx.2 nginx:latest ip-172-31-28-47 Running Running 28 minutes ago
7emcgjqq8r9t test_nginx.3 nginx:latest ip-172-31-28-47 Running Running 28 minutes ago
--------------------------------------------------------------------------------------------
$ docker service --help
-------------------------------------------------------------------
Usage: docker service COMMAND
Manage services
Commands:
create Create a new service
inspect Display detailed information on one or more services
logs Fetch the logs of a service or task
ls List services
ps List the tasks of one or more services
rm Remove one or more services
rollback Revert changes to a service's configuration
scale Scale one or multiple replicated services
update Update a service
-------------------------------------------------------------------
[example]
$ docker service create --name <SERVICE_NAME> <OPTIONS> <IMAGE>:<IMAGE_VERSION>
$ docker service ls
--------------------------------------------------------------------------------------------
ID NAME MODE REPLICAS IMAGE PORTS
jwb1gh8ujbnk test_nginx replicated 3/3 nginx:latest *:6666->80/tcp
--------------------------------------------------------------------------------------------
$ docker service scale <SERVICE_NAME>=<COUNT>
$ docker service ps
--------------------------------------------------------------------------------------------
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
lp6c58slnydn test_nginx.1 nginx:latest ip-172-31-28-47 Running Running 25 minutes ago
r97y6j7h6g7v test_nginx.2 nginx:latest ip-172-31-28-47 Running Running 21 minutes ago
7emcgjqq8r9t test_nginx.3 nginx:latest ip-172-31-28-47 Running Running 21 minutes ago
--------------------------------------------------------------------------------------------
$ docker service update --image <NEW_IMAGE> <SERVICE_NAME>
$ docker stack --help
-------------------------------------------------------------------
Usage: docker stack [OPTIONS] COMMAND
Manage Docker stacks
Options:
--orchestrator string Orchestrator to use (swarm|kubernetes|all)
Commands:
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
-------------------------------------------------------------------
$ docker stack deploy --help
-------------------------------------------------------------------
Usage: docker stack deploy [OPTIONS] STACK
Deploy a new stack or update an existing stack
Aliases:
deploy, up
Options:
--bundle-file string Path to a Distributed Application Bundle file
-c, --compose-file strings Path to a Compose file, or "-" to read from stdin
--orchestrator string Orchestrator to use (swarm|kubernetes|all)
--prune Prune services that are no longer referenced
--resolve-image string Query the registry to resolve image digest and supported platforms ("always"|"changed"|"never") (default "always")
--with-registry-auth Send registry authentication details to Swarm agents
-------------------------------------------------------------------
[example]
$ docker stack deploy -c <docker-compose.yml PATH> --with-registry-auth
'DevOps > Docker' 카테고리의 다른 글
docker container stop 안될 때 또는 docker-compose down 안될 때 (0) | 2019.06.08 |
---|---|
docker swarm 사용 시 manager mode 전환할 때 주의 (0) | 2019.06.08 |
docker-machine 명령어 (0) | 2019.05.29 |
docker 명령어 (0) | 2019.05.22 |
[postgres in Docker] FATAL: password authentication failed for user 오류 해결 (0) | 2019.02.27 |