Can I use dynamic generated values in docker-compose.yml
file like in the code below?
version: "3"
services:
php:
build:
context: ./.docker-config/dockerfiles
dockerfile: php.dockerfile
args:
- HOST_UID=${id -u}
- HOST_GID=${id -g}
- HOST_USER=${whoami}
volumes:
- ./:/var/www/html:delegated
...and in the php.dockerfile
:
ARG HOST_UID
ARG HOST_USER
RUN useradd $HOST_USER -u $HOST_UID
It says:
ERROR: Invalid interpolation format for "build" option in service "php": "HOST_UID=${id -u}"
I think now the parameter passed into container contains this string: ${id -u}
and not the value of the expression.
Can I somehow pass in the result of the expression?