Skip to content

ERROR: json: cannot unmarshal string into Go value of type []string #2515

Closed

Description

@vskubriev

Software versions:

$ docker-compose -v
docker-compose version 1.5.2, build 7240ff3
$ docker -v
Docker version 1.9.1, build a34a1d5

compose.yml:

mycont:
  #tty: true
  #entrypoint: /sbin/init
  env_file: ".env"
  build: "."
  container_name: "mycont"
  domainname: "example.lab"
  hostname: "mycont"
  dns: "192.168.128.3"
  dns_search: "example.lab"
  restart: "always"
  expose:
    - "389"
    - "80"
  extra_hosts:
    - "ldap.example.lab:192.168.1.10"
    - "ldap:192.168.1.10"
    - "tgnpdc:192.168.1.10"
  # http://blog.oddbit.com/2014/08/11/four-ways-to-connect-a-docker/
  net: "bridge"
  ports:
    - "389:389"
    - "80:80"

Error:

$ docker-compose up -d
Recreating 177deb9c24_177deb9c24_177deb9c24_177deb9c24_177deb9c24_177deb9c24_177deb9c24_177deb9c24_177deb9c24_177deb9c24_177deb9c24_177deb9c24_177deb9c24_177deb9c24_177deb9c24_mycont
ERROR: json: cannot unmarshal string into Go value of type []string

I suspect that this is because latest updates installed.

Activity

  1. aanand commented on Dec 8, 2015

    @aanand

    It looks like these are the offending lines:

    dns: "192.168.128.3"
    dns_search: "example.lab"

    If I wrap the string literals in [], it works again.

    Single string values are supposed to work - this might be a regression resulting from a lot of refactoring around config processing. We don't appear to have enough tests in place.

  2. added this to the 1.6.0 milestone on Dec 8, 2015
  3. self-assigned this
    on Dec 8, 2015
  4. dnephin commented on Dec 8, 2015

    @dnephin

    Oops, the convert to list is only being applied during a merge of services. It also needs to be applied if there is no merge.

  5. vskubriev commented on Dec 9, 2015

    @vskubriev
    Author

    @aanand How to wrap the string literals in [] ? Can you give an example ? This is true for all string literals with new config processing?

  6. aanand commented on Dec 9, 2015

    @aanand

    @vskubriev You can work around it like this:

    dns: ["192.168.128.3"]
    dns_search: ["example.lab"]

    It's not true for all string literals, only dns and dns_search.

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions