I trying to pass the current user id into docker-compose.yml
How it looks in docker-compose.yml
version: '3.4'
services:
app:
build:
context: ./
target: "php-${APP_ENV}"
user: "${CURRENT_UID}"
Instead of CURRENT_UID=$(id -u):$(id -g) docker-compose up -d
I've wrote makefile
#!/usr/bin/make
SHELL = /bin/sh
up:
export CURRENT_UID=$(id -u):$(id -g)
docker-compose up -d
But CURRENT_UID
still empty when I run make up
Is there a possible export uid in makefile?
3条答案
按热度按时间qij5mzcb1#
这是我的解决方案
rjee0c152#
另一个选择是使用
env
:生成文件:
holgip5t3#
您需要在(id -u)和(id -g)之前使用2个美元符号($$)。