I have 2 services that are very similar. I have seen that it is a common practice to give a variable name to one service configuration and use it and extend it in your specific services’ configurations.
services:
backend: &backend
build:
context: .
dockerfile: ./docker/app/DockerFile
volumes:
- .:/var/www/apps
app:
<<: *backend
ports:
- 127.0.0.1:3000:3000
depends_on:
- db
- dashboard_db
- redis
- sidekiq
sidekiq:
<<: *backend
depends_on:
- redis
command: bundle exec sidekiq
The problem is that when I execute docker compose up
the service backend
is also up and running, but in my case, I only want the specific services (app
and sidekiq
) to be up.
Am I using the &variable
syntax properly?
0