Docker Swarm Creating a Complete Stack File Part 2

Posted By Apoorv Singh | 31-Jan-2019

RESTART POLICY 

Arranges if and how to restart containers when they exit. Replaces restart. 

1. condition: One of none, on-failure or any (default: any). 

2. delay: How long to hold up between restarted containers, determined as a length (default: 0). 

3. max_attempts: what number occasions to containers to restart a compartment before surrendering (default: never surrender). In the event that the restart does not prevail inside the designed window, this endeavor doesn't tally toward the arranged max_attempts esteem. For instance, if max_attempts is set to '2', and the restart flops on the main endeavor, more than two restarts might be endeavored. 

4. window: How long to hold up before choosing if a restart has succeeded, determined as a length (default: choose quickly).

deploy:
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 120s

 

ROLLBACK_CONFIG

Designs how the administration ought to be rollbacked if there should be an occurrence of a coming up short refresh. 

1. parallelism: The quantity of holders to rollback at once. Whenever set to 0, all compartments rollback at the same time. 

2. delay: an opportunity to hold up between every holder gathering's rollback (default 0s). 

3. failure_action: What to do if a rollback comes up short. One of proceed or interruption (default delay) 

4. screen: Duration after each errand refresh to screen for disappointment (ns|us|ms|s|m|h) (default 0s). 

5. max_failure_ratio: Failure rate to endure amid a rollback (default 0). 

6. arrange: Order of tasks amid rollbacks. One of stop-first (old errand is ceased before beginning new one), or begin first (new assignment is begun first, and the running undertakings quickly cover) (default stop-first).

 

DEPENDS_ON KEY

Express reliance between administrations, Service conditions cause the accompanying practices: 

1. docker-make up begins benefits in reliance arrange. In the accompanying model, db and redis are begun before web. 

2. docker-make up SERVICE naturally incorporates SERVICE's conditions. In the accompanying model, docker-make up web additionally makes and begins db and redis. 

3. docker-make stop stops benefits in reliance arrange. In the accompanying precedent, web is ceased before db and redis.

version: '3'
services:
  web:
    build: .
    depends_on:
      - db
      - redis
  redis:
    image: redis
  db:
    image: postgres

 

ENTRYPOINT

Override the default entrypoint
Entrypoint may also be a list, in a way similar to dockerfile.

 

entrypoint:
    - php
    - -d
    - zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so
    - -d
    - memory_limit=-1
    - vendor/bin/phpunit

 

ENV_FILE

Include condition factors from a document. Can be a solitary esteem or a rundown. 

On the off chance that you have determined a Compose document with docker-make - f FILE, ways in env_file are in respect to the index that record is in. 

Condition factors pronounced in the earth segment abrogate these qualities – this remains constant regardless of whether those qualities are unfilled or vague.

env_file: .env

env_file:
  - ./common.env
  - ./apps/web.env
  - /opt/secrets.env
 

 

 

Request for Proposal

Recaptcha is required.

Sending message..