我试图将当前用户ID传递给docker-compose.yml
它在docker-compose.yml
中的样子
version: '3.4'
services:
app:
build:
context: ./
target: "php-${APP_ENV}"
user: "${CURRENT_UID}"
而不是CURRENT_UID=$(id -u):$(id -g) docker-compose up -d
我写了makefile
#!/usr/bin/make
SHELL = /bin/sh
up:
export CURRENT_UID=$(id -u):$(id -g)
docker-compose up -d
但是当我运行CURRENT_UID
时,make up
仍然空着
makefile中是否有可能的导出uid?
这是我的解决方案
#!/usr/bin/make
SHELL = /bin/sh
CURRENT_UID := $(shell id -u)
CURRENT_GID := $(shell id -g)
export CURRENT_UID
export CURRENT_GID
up:
docker-compose up -d