arquillian / arquillian-cube

Control (docker, kubernetes, openshift) containers in your tests with ease!
http://arquillian.org/arquillian-cube/
120 stars 98 forks source link

Escaping of dollar sign in docker-compose.yml doesn't work #1117

Closed wkruse closed 1 year ago

wkruse commented 5 years ago

Docker Compose supports variable substitution. In order to use $ literal in docker-compose.yml, double-dollar sign $$ can be used.

https://docs.docker.com/compose/compose-file/#variable-substitution

When running in Arquillian Cube, the double-dollar sign $$ is not processed and breaks therefore the command.

For example:

nginx:
    image: nginx:1.15.8-alpine-perl
    ports:
      - 80:80
    command:
      - /bin/sh
      - -c
      - ip -4 route list match 0/0 | awk '{print $$3" host.docker.internal"}' >> /etc/hosts && exec nginx -g 'daemon off;'

docker inspect when running the docker-compose.yml directly:

"Cmd": [
                "/bin/sh",
                "-c",
                "ip -4 route list match 0/0 | awk '{print $3\" host.docker.internal\"}' >> /etc/hosts && exec nginx -g 'daemon off;'"
            ],

docker inspect when running in Arquillian Cube:

"Cmd": [
                "/bin/sh",
                "-c",
                "ip -4 route list match 0/0 | awk '{print $$3\" host.docker.internal\"}' >> /etc/hosts && exec nginx -g 'daemon off;'"
            ],
<details>
 <summary>$mvn --version</summary>
 Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T18:41:47Z)
 Maven home: /usr/share/maven
 Java version: 1.8.0_181, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-8-openjdk- amd64/jre
 Default locale: en, platform encoding: UTF-8
 OS name: "linux", version: "4.9.125-linuxkit", arch: "amd64", family: "unix"
</details>

Arquillian Cube Version 1.18.3 (build from master).