# Commas in Docker env option for values of environment variables?

**URL:** <https://forum.ansible.com/t/commas-in-docker-env-option-for-values-of-environment-variables/17545>\
**Category:** Ansible Project\
**Created:** [February 18, 2015, 6:24am UTC](https://forum.ansible.com/t/commas-in-docker-env-option-for-values-of-environment-variables/17545 "2015-02-18T06:24:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Webster](https://avatars.discourse-cdn.com/v4/letter/j/a698b9/32.png) [@James\_Webster](https://forum.ansible.com/u/James_Webster)\
**Post date:** [February 18, 2015, 6:24am UTC](https://forum.ansible.com/t/commas-in-docker-env-option-for-values-of-environment-variables/17545/1 "2015-02-18T06:24:20Z")

</div>

I’m using Consul in combination with a service registration framework (progrium/registrator Docker image) to play around with distributed service discovery. Plus Ansible to start up my Docker containers, etc. However I’m running into a limitation with the ‘env’ option of the Docker module. The registration framework can allow me to set multiple ‘tags’ for a service, but requires them to be expressed as a single environment variable with comma-separate values, eg.

env=“SERVICE\_80\_TAGS=master,http”

of course, this falls over because the Docker module is expecting multiple environment variables to be comma separated;

env=“SOME\_ENV\_A=valueA,SOME\_ENV\_B=valueB”

Can I get this to work with escaping, or would it be possible to support an alternative separator in env?

env=“SERVICE\_80\_TAGS=master,http:SOME\_ENV\_A=valueA:SOME\_ENV\_B=valueB”

---

<div class="post-metadata">

**Author:** ![pporada](https://avatars.discourse-cdn.com/v4/letter/p/b4bc9f/32.png) [@pporada](https://forum.ansible.com/u/pporada)\
**Post date:** [August 24, 2016, 2:48pm UTC](https://forum.ansible.com/t/commas-in-docker-env-option-for-values-of-environment-variables/17545/2 "2016-08-24T14:48:26Z")

</div>

I’m affected by this as well using the new docker\_container ansible module.

---

<div class="post-metadata">

**Author:** ![pporada](https://avatars.discourse-cdn.com/v4/letter/p/b4bc9f/32.png) [@pporada](https://forum.ansible.com/u/pporada)\
**Post date:** [August 24, 2016, 2:54pm UTC](https://forum.ansible.com/t/commas-in-docker-env-option-for-values-of-environment-variables/17545/3 "2016-08-24T14:54:40Z")

</div>

James,

Just in case you’re still stuck on this for whatever reason, we figured out how to make this work with the docker\_container module. Ansible doesn’t have this documented.

`

- name: Start Webhook  
docker\_container:  
image: “company/webhook:{{microservice\_webhook\_tag}}”  
name: “webhook”  
state: started  
detach: true  
restart\_policy: on-failure  
env:  
CONSUL\_LOCATION: “{{ (ansible\_docker0.ipv4|default(ansible\_default\_ipv4)).address }}:8500”  
LOG\_LEVEL: “{{microservice\_webhook\_env\_loglevel}}”  
SERVICE\_NAME: “webhook”  
SERVICE\_TAGS:
- “{{microservice\_webhook\_tag}}”
- “{{microservice\_some\_other\_tag}}”  
`
