root@ip-172-31-15-174 ~]# cat myservice.yml
version: '3'
services:
my-app:
image: nginx:latest
deploy:
replicas: 3
restart_policy:
condition: on-failure
ports:
- "8081:80"
[root@ip-172-31-15-174 ~]# docker stack deploy --compose-file myservice.yml test-app
Creating network test-app_default
Creating service test-app_my-app
[root@ip-172-31-15-174 ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
NAMES
1050478c859a nginx:latest "/docker-entrypoint.…" 2 minutes ago Exited (0) About a minute ago
test-app_my-app.1.ifnzpj756lq6f27g3h7fdvrxz
0f94419281dc nginx:latest "/docker-entrypoint.…" 2 minutes ago Up 2 minutes 80/tcp
test-app_my-app.2.vjo1lcb3tismhc4psq21xe555
880fe2587512 nginx:latest "/docker-entrypoint.…" 2 minutes ago Up 2 minutes 80/tcp
test-app_my-app.3.j2wonx6yr7v3vejt65xv7rfqa
11d0593d925d dockersamples/visualizer "/sbin/tini -- node …" 8 minutes ago Up 8 minutes (healthy) 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp strange_ritchie
[root@ip-172-31-15-174 ~]#
[root@ip-172-31-15-174 ~]#
[root@ip-172-31-15-174 ~]#
[root@ip-172-31-15-174 ~]# docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
1daq9y4d70yr test-app_my-app replicated 2/3 nginx:latest *:8081->80/tcp
No comments:
Post a Comment