docker / compose

Define and run multi-container applications with Docker
https://docs.docker.com/compose/
Apache License 2.0
33.98k stars 5.23k forks source link

version 1.10.0 error on gateway spec #4366

Closed jhmnieuwenhuis closed 7 years ago

jhmnieuwenhuis commented 7 years ago
version: "3"

services:

  nexus:
    build: ../docker4man-nexus-2.0/.
    container_name: d4m-nexus
    image: d4m-nexus
    env_file: env-docker4man-nexus.txt
    restart: "no"
    ports:
      - "8081:8081"
      - "8443:8443"
      - "18443:18443"
      - "18444:18444"
    volumes:
      - "d4m-nexus-volume:/nexus-data"
    networks:
      - backend

volumes :
  d4m-nexus-volume:
    external: true
  nexus_30-volume:
    external: true

networks:
  backend:
    driver: bridge
    ipam:
      config:
        - subnet: 172.20.1.0/24
          gateway: 172.20.1.1

docker-compose up gives error :

ERROR: The Compose file './yaml-docker4man-nexus-2.0/docker4man-nexus.yml' is invalid because: networks.backend.ipam.config value Additional properties are not allowed ('gateway' was unexpected)

Is this a bug ?

If I change version from 3 to 2, there is no error.

shin- commented 7 years ago

cc @dnephin

Looks like an incomplete definition of the IPAMPool type here, not sure whether that's intentional or not.

dnephin commented 7 years ago

It is intentional. Swarm mode doesn't support setting the rest of these fields (as of docker 1.12), so they are excluded from the V3 format.

If/when that changes we can add them to 3.1

jhmnieuwenhuis commented 7 years ago

Ok Thanks for the answers. Does this mean that I have to stick to version 2. Or is it no longer necessary to define the gateway when not in swarm mode in version 3 ? How does it define the gateway then...

Regards

dnephin commented 7 years ago

It was never necessary to define a gateway for most use cases. You only need it if you want to customise the network. In swarm mode the network is more tightly managed by swarmkit, so it isn't possible to control the gateway (yet at least).

jhmnieuwenhuis commented 7 years ago

OK Thanks again !!

Regards

On Jan 23, 2017 18:36, "Daniel Nephin" notifications@github.com wrote:

It was never necessary to define a gateway for most use cases. You only need it if you want to customise the network. In swarm mode the network is more tightly managed by swarmkit, so it isn't possible to control the gateway (yet at least).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/docker/compose/issues/4366#issuecomment-274559693, or mute the thread https://github.com/notifications/unsubscribe-auth/AM-4BkIIlzewAvVxXsh71IgHPKvsypn3ks5rVOUvgaJpZM4LpMvw .

guhcampos commented 7 years ago

It was never necessary to define a gateway for most use cases. You only need it if you want to customise the network. In swarm mode the network is more tightly managed by swarmkit, so it isn't possible to control the gateway (yet at least).

Was there any discussion on that? I do need to customize the network, because my company uses the 172.16.0.0/16 address range at some segments and Docker will simply clash with that by default, so every single Docker server in the whole company needs a forced network setting.

Now while upgrading my dev environment to Docker 1.13 it took me hours to stumble into this Github issue, because the removal of those options was completely undocumented.

So please, if I am working on a network which requires a custom docker subnet, how am I supposed to use Docker Compose and Docker Swarm?

shin- commented 7 years ago

@guhcampos Can you create an issue on docker/docker? Like @dnephin said, this is unsupported by Swarm mode, so there's nothing we can do at our level.