kris_IV
kris_IV

Reputation: 2444

Restart: always with force-recreate

In .yml file I have defined: restart: always. Is it possible to create this restart as the equivalent of --force-recreate flag?

I have an issue with XVFB and standard restart doesn't solve an issue but restarts with the flag --force-recreate help and I'm looking for an opportunity to do it automatically.

Upvotes: 2

Views: 2690

Answers (1)

Gregor Wedlich
Gregor Wedlich

Reputation: 726

Always restart the container if it stops. If it is manually stopped, it is restarted only when Docker daemon restarts or the container itself is manually restarted. (See the second bullet listed in restart policy details) Source Link:

No --force-recreate is not the equivalent to restart: always

"--force-recreate Recreate containers even if their configuration and image haven't changed."

I use a Makefile for start/stop is also more practical.

Example:

SHELL := /bin/bash

# Docker: up
up:
    docker-compose up -d --force-recreate --build

# Docker: down
down:
    docker-compose down


... and so on

And than i can use like "make up, make down, make logs, make attach ..."

By the way, in most projects I also use for Automatic Restart and better logging Supervisor

Upvotes: 1

Related Questions