I was trying to pass ENV_VAR to a container, but it was not working.
version: '3.7'
services:
ubuntu:
image: ubuntu:latest
environment:
- ENV_VAR=teste
command: "echo ${ENV_VAR}"
The problem was solved using $$ instead of $:
version: '3.7'
services:
ubuntu:
image: ubuntu:latest
environment:
- ENV_VAR=teste
command: '/bin/sh -c "echo $$ENV_VAR"'
But, I dont understand why I had to call sh and I dont belive that a running app inside my image will be able to read this value.