micahhausler / container-transform

Transforms docker-compose, ECS, and Marathon configurations
MIT License
1.41k stars 146 forks source link

Support for "9995:9995/tcp" #59

Open SerCeMan opened 7 years ago

SerCeMan commented 7 years ago
Traceback (most recent call last):
  File "/usr/local/bin/container-transform", line 9, in <module>
    load_entry_point('container-transform==1.1.4', 'console_scripts', 'container-transform')()
  File "/usr/local/lib/python3.5/site-packages/click-6.6-py3.5.egg/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/click-6.6-py3.5.egg/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.5/site-packages/click-6.6-py3.5.egg/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.5/site-packages/click-6.6-py3.5.egg/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/container_transform-1.1.4-py3.5.egg/container_transform/client.py", line 64, in transform
    output = converter.convert(verbose)
  File "/usr/local/lib/python3.5/site-packages/container_transform-1.1.4-py3.5.egg/container_transform/converter.py", line 57, in convert
    output_transformer
  File "/usr/local/lib/python3.5/site-packages/container_transform-1.1.4-py3.5.egg/container_transform/converter.py", line 90, in _convert_container
    output[output_name] = emit_func(ingest_func(container.get(input_name)))
  File "/usr/local/lib/python3.5/site-packages/container_transform-1.1.4-py3.5.egg/container_transform/compose.py", line 138, in ingest_port_mappings
    return [self._parse_port_mapping(mapping) for mapping in port_mappings]
  File "/usr/local/lib/python3.5/site-packages/container_transform-1.1.4-py3.5.egg/container_transform/compose.py", line 138, in <listcomp>
    return [self._parse_port_mapping(mapping) for mapping in port_mappings]
  File "/usr/local/lib/python3.5/site-packages/container_transform-1.1.4-py3.5.egg/container_transform/compose.py", line 105, in _parse_port_mapping
    'container_port': int(parts[1]),
ValueError: invalid literal for int() with base 10: '9995/tc'
micahhausler commented 7 years ago

It looks like you have a malformed port. Review the docker-compose reference on port mappings.

SerCeMan commented 7 years ago

Actually port 9995:9995/tcp is valid, check https://github.com/docker/compose/blob/28120148f4e1380096407626f846eda8f6970f36/tests/fixtures/expose-composefile/docker-compose.yml

micahhausler commented 7 years ago

Ah ok, yea I can add support for the /tcp. The output you supplied was trying to load 9995/tc, which looks malformed.

SerCeMan commented 7 years ago

This is what it showed to me. I tested it with https://github.com/dawidmalina/docker-pinpoint

cmrigney commented 7 years ago

I'm also experiencing this issue.

helsont commented 6 years ago

I'm running the following command to get a production docker-compose.yml:

docker-compose -f docker-compose.yml -f docker-compose.production.yml config | docker run --rm -i micahhausler/container-transform -i compose -o ecs

The output from the config command for the port section returns

    ports:
    - 7000:7000/tcp

even though my docker-compose.yml explicitly says

    ports:
        - "7000:7000"

but the utility fails with the "/tcp" specification.

iTaybb commented 5 years ago

The parser won't parse - 7000:7000/tcp correctly.