restart policies configuration for Docker Compose

This commit is contained in:
Christian Jaimes 2022-05-22 07:47:15 -04:00
parent f62a3ee5ca
commit 0cd4aeca9f
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