Compose: Literal json string in environment is deserialized by compose

Created on 25 Aug 2016  路  1Comment  路  Source: docker/compose

version: "2"

services:
  foo:
    image: busybox
    command: sleep 50
    environment:
    - FOOBAR: '{"foo": "bar"}'
# docker-compose up
ERROR: The Compose file './docker-compose.yml' is invalid because:
services.foo.environment contains {"FOOBAR": "{\"foo\": \"bar\"}"}, which is an invalid type, it should be a string

I've tried several different methods of escaping or quoting {"foo": "bar"} but compose won't pass through the string.

kinquestion

Most helpful comment

Remove the dash - at the beginning of the line. environment is either a list of strings, like such:

environment:
  - FOOBAR='{"foo": "bar"}'

or a dictionary

environment:
  FOOBAR: '{"foo": "bar"}'

>All comments

Remove the dash - at the beginning of the line. environment is either a list of strings, like such:

environment:
  - FOOBAR='{"foo": "bar"}'

or a dictionary

environment:
  FOOBAR: '{"foo": "bar"}'
Was this page helpful?
0 / 5 - 0 ratings

Related issues

29e7e280-0d1c-4bba-98fe-f7cd3ca7500a picture 29e7e280-0d1c-4bba-98fe-f7cd3ca7500a  路  3Comments

HackerWilson picture HackerWilson  路  3Comments

maltefiala picture maltefiala  路  3Comments

saulshanabrook picture saulshanabrook  路  3Comments

AvdN picture AvdN  路  3Comments