Compose: Escaping Dollar Sign for strings in docker compose

Created on 16 May 2018  路  1Comment  路  Source: docker/compose

Just for the start. This is not an issue about environment variable expansion.

I have a definition for a MariaDB:

image: mariadb:10.2
restart: always
environment:
- MYSQL_USER=blabla
- MYSQL_PASSSWORD=123$abc

This raises the warning: Variable abc is not set. Defaulting to a blank string.

There is lots of topic talking about environment variable expansion. But none of them talk about $ escaping.

Can you help?

Most helpful comment

As documented in https://docs.docker.com/compose/compose-file/#variable-substitution, you can use a double dollar $$ to escape a $ and prevent variable expansion.

>All comments

As documented in https://docs.docker.com/compose/compose-file/#variable-substitution, you can use a double dollar $$ to escape a $ and prevent variable expansion.

Was this page helpful?
0 / 5 - 0 ratings