Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 488
Quinn Wynn Avatar asked Oct 23 '18 04:10

Quinn Wynn


People also ask

How do I run a specific service in docker compose?

To start (up), stop, restart or build a single service (container) using the Docker Compose, simply specify the name of the service against which to run the corresponding docker-compose command.

What is docker compose config?

Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application's services. Then, with a single command, you create and start all the services from your configuration.

Does docker compose run multiple containers?

With Docker compose, you can configure and start multiple containers with a single yaml file. This is really helpful if you are working on a technology stack with multiple technologies.


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
like image 156
Jesse Chisholm Avatar answered Oct 18 '22 10:10

Jesse Chisholm