Compose: Unable to create container with label

Created on 3 Nov 2017  路  5Comments  路  Source: docker/compose

With the following container we are getting an error creating the container:

  dynamodb:
    image: instructure/dynamo-local-admin
    labels:
      - "com.acuris.service.group=companyhub"
    ports:
      - "8000:8000"

When we run the command:

docker-compose run dynamodb

We get the error:

Traceback (most recent call last):
  File "/bin/docker-compose", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 68, in main
    command()
  File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 121, in perform_command
    handler(command, command_options)
  File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 768, in run
    run_one_off_container(container_options, self.project, service, options)
  File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 1178, in run_one_off_container
    **container_options)
  File "/usr/lib/python2.7/site-packages/compose/service.py", line 288, in create_container
    previous_container=previous_container,
  File "/usr/lib/python2.7/site-packages/compose/service.py", line 795, in _get_container_create_options
    self.config_hash if add_config_hash else None)
  File "/usr/lib/python2.7/site-packages/compose/service.py", line 1338, in build_container_labels
    labels = dict(label_options or {})
ValueError: dictionary update sequence element #0 has length 35; 2 is required

However, if we change the container definition to the following then it works:

  dynamodb:
    image: instructure/dynamo-local-admin
    labels:
      com.acuris.service.group: companyhub
    ports:
      - "8000:8000"

This has only started failing since we upgraded to docker-compose version 1.17.0, build ac53b73.

areconfig kinbug

Most helpful comment

I was able to fix this on my system by changing:

    labels:
      - "com.acuris.service.group=companyhub"

to:

    labels:
      com.acuris.service.group: "companyhub"

All 5 comments

Same problem here with latest release (1.17.0)

ubuntu@master:~$ docker-compose up
ubuntu_traefik_1 is up-to-date
Creating ubuntu_rancher-server_1 ...

ERROR: for ubuntu_rancher-server_1  dictionary update sequence element #0 has length 23; 2 is required

ERROR: for rancher-server  dictionary update sequence element #0 has length 23; 2 is required
Traceback (most recent call last):
 File "bin/docker-compose", line 6, in <module>
 File "compose/cli/main.py", line 68, in main
 File "compose/cli/main.py", line 121, in perform_command
 File "compose/cli/main.py", line 952, in up
 File "compose/project.py", line 455, in up
 File "compose/parallel.py", line 70, in parallel_execute
ValueError: dictionary update sequence element #0 has length 23; 2 is required
Failed to execute script docker-compose

Thanks for the report! I'll look into it asap.

How would I go about working around this issue while I wait for 1.17.1?

@doritostains As the original poster points out, the dictionary format works as expected.

I was able to fix this on my system by changing:

    labels:
      - "com.acuris.service.group=companyhub"

to:

    labels:
      com.acuris.service.group: "companyhub"
Was this page helpful?
0 / 5 - 0 ratings

Related issues

bergtwvd picture bergtwvd  路  3Comments

darkrasid picture darkrasid  路  3Comments

DhairyashilBhosale picture DhairyashilBhosale  路  3Comments

maltefiala picture maltefiala  路  3Comments

dazorni picture dazorni  路  3Comments