Is it possible to config docker-compose to ignore error of one their services and continue others?

Viewed 2534

I wonder if we have an option to configure docker-compose to ignore errors of one of the containers and continue to start others.

For example, here is my docker-compose.yml

version: '3'
services:
  web:
    build: .
  redis:
    image: redis

If redis container fails to start, the web container still start.

1 Answers

The only way I know of to do what you are asking is a bit ugly:

Bring your services up one at a time, ignoring any errors:

docker-compose up -d web || true
docker-compose up -d redis || true
Related