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.
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.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With