Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

services.xxx.networks contains {"ExtNet": {"ipv4_address": "192.168.1.11"}}, which is an invalid type, it should be a string #4613

Closed
mathew-bulletin opened this issue Mar 13, 2017 · 4 comments

Comments

@mathew-bulletin
Copy link

Envionment:

docker-compose version 1.11.2, build dfed245
docker-py version: 2.1.0
CPython version: 2.7.5
OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
Linux 3.10.0-514.6.1.el7.x86_64 #1 SMP Wed Jan 18 13:06:36 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux```

Scenario:

version: '2.1'

services:
  xxx:
    image: xxx:latest
    networks:
      - ExtNet:
          ipv4_address: 192.168.1.11
      - IntNet

networks:
  ExtNet:
    driver: macvlan
    driver_opts:
      parent: enp3s0
    ipam:
      config:
        - gateway: 192.168.1.1
          ip_range: 192.168.1.10/28
          subnet: 192.168.1.0/24
  IntNet:
    internal: True
    driver: bridge
    ipam:
      config:
        - ip_range: 10.0.0.0/16
          subnet: 10.0.0.0/16

Error:

services.xxx.networks contains {"ExtNet": {"ipv4_address": "192.168.1.11"}}, which is an invalid type, it should be a string

# Tried docker compose yaml version 2.0, 2.1 and 3.0.

Expected:

  • The ability to assign Static IP from ExtNet to xxx docker container in the above example.
@mathew-bulletin mathew-bulletin changed the title services.xxx.networks contains {"ExtNet": {"ipv4_address": "192.168.1.10"}}, which is an invalid type, it should be a string services.xxx.networks contains {"ExtNet": {"ipv4_address": "192.168.1.11"}}, which is an invalid type, it should be a string Mar 13, 2017
@mathew-bulletin
Copy link
Author

Update

  • Adding ExtNet by itself to the container seems to be OK:
services:
  xxx:
    image: xxx:latest
    networks:
      - ExtNet:
          ipv4_address: 192.168.1.11

@mathew-bulletin
Copy link
Author

mathew-bulletin commented Mar 13, 2017

It seems that if one of items in "services.xxx.networks" is a string (in this case, "IntNet"), it expects all of the items to be a string.
Would it be possible to change "services.xxx.networks" to expect tuple?

@shin-
Copy link

shin- commented Mar 13, 2017

Actually, that second configuration is incorrect as well. networks is either a list of strings or a mapping (that's YAML's name for python's dict). https://docs.docker.com/compose/compose-file/compose-file-v2/#networks

For example, here's a valid format for your desired config:

services:
  xxx:
    image: xxx:latest
    networks:
      ExtNet:
        ipv4_address: 192.168.1.11
      IntNet: {}

@mathew-bulletin
Copy link
Author

Cool that works. Thank you so much :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants