Docker Community Forums

Share and learn in the Docker community.

Networks from docker-compose.yml are ignored when I use docker-compose.override.yml


(Rick Peters) #1

I have a docker-compose file (from the docker birthday voting-app) that defines two networks. I moved the volume definitions for the services to a docker-compose.override.yml because a local volume on my laptop does not work when deploying to digitalocean.
Problem is that when using the docker-compose.override.yml the networks: definition for the services gets lost and docker-compose warns that networks are defined but not used.

As an example, I can see this when you use docker-compose config (this will use both the default and override file. This would show for example (just the voting-app service in the example):

  voting-app:
    build:
      context: /Users/rickpeters/Dropbox/gitrepos/docker-birthday-3/example-voting-app/voting-app
    links:
    - redis
    ports:
    - 8888:80
    volumes:
    - /Users/rickpeters/Dropbox/gitrepos/docker-birthday-3/example-voting-app/voting-app:/app:rw

when I test with docker-compose -f docker-compose.yml config it shows:

  voting-app:
    build:
      context: /Users/rickpeters/Dropbox/gitrepos/docker-birthday-3/example-voting-app/voting-app
    links:
    - redis
    networks:
    - front-tier
    - back-tier
    ports:
    - 8888:80

I can’t explain this behavior from the documentation pages, so it looks like a bug to me?

regards,
Rick