Merge pull request #12247 from chrisjaimes/docker_compose_restart_policies

Docker compose restart policies
This commit is contained in:
Greg Martin 2022-06-01 13:14:10 -04:00 committed by GitHub
commit b613e6f363
2 changed files with 64 additions and 0 deletions

View File

@ -0,0 +1,37 @@
version: '3'
services:
message-server:
container_name: message-server
build:
context: docker-message-server
dockerfile: Dockerfile
image: message-server:latest
ports:
- 18888:8888
networks:
- spring-cloud-network
deploy:
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s
product-server:
container_name: product-server
build:
context: docker-product-server
dockerfile: Dockerfile
image: product-server:latest
ports:
- 19999:9999
networks:
- spring-cloud-network
deploy:
restart_policy:
condition: on-failure
delay: 3s
max_attempts: 5
window: 60s
networks:
spring-cloud-network:
driver: bridge

View File

@ -0,0 +1,27 @@
version: '2'
services:
message-server:
container_name: message-server
build:
context: docker-message-server
dockerfile: Dockerfile
image: message-server:latest
ports:
- 18888:8888
networks:
- spring-cloud-network
restart: always
product-server:
container_name: product-server
build:
context: docker-product-server
dockerfile: Dockerfile
image: product-server:latest
ports:
- 19999:9999
networks:
- spring-cloud-network
restart: on-failure
networks:
spring-cloud-network:
driver: bridge