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

Support a map for networks as well as string[] #5

Open
TylerRick opened this issue Dec 12, 2017 · 2 comments
Open

Support a map for networks as well as string[] #5

TylerRick opened this issue Dec 12, 2017 · 2 comments

Comments

@TylerRick
Copy link

TylerRick commented Dec 12, 2017

Documented here: https://docs.docker.com/compose/compose-file/#aliases

Example:

⟫ cat docker-compose-network-map.yml
version: '2'
services:
  postgres:
    image: mdillon/postgis:9.5
    networks:
      default:
        aliases:
          - db

Current behavior:

⟫ ./container-tx < docker-compose-network-map.yml
Error ingesting file: yaml: unmarshal errors:
  line 6: cannot unmarshal !!map into []string 

Expected:

I'm guessing something like this (not 100% sure yet):

⟫ ./container-tx < docker-compose-network-map.yml
docker network create projectname_default

######## postgres ########
docker run \
    --name postgres \
    --network projectname_default \
    --network-alias db \
    mdillon/postgis:9.5
@TylerRick
Copy link
Author

Looks like this is a problem if you use docker-compose config as the input as well, even if you listed as an array in your file.

If you have this in your file:

    networks:
      - default
      - public

, then docker-compose config apparently normalizes it to this:

    networks:
      default: null
      public: null

@micahhausler
Copy link
Owner

Yea this is another one of those cases where docker-compose keeps changing (improving?) their format, and it leaves everyone chasing their tail to keep up with it.

One bigger strategy for all this might be ingesting compose's openAPI schema definitions and searching for all the fields with a schema of oneOf, and then appropriately parsing each case

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

No branches or pull requests

2 participants