Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add environment variables for client OS/arch and client user UID/GID
When using Docker Compose for development setup, you often need to tweak the configuration to vary on Linux, macOS, and Windows. And some services you would like to run with the same UID/GID as your current client user. To help with that, we introduce four new environment variables while parsing the configuration files: - `COMPOSE_CLIENT_OS`: set to Go's `runtime.GOOS` - `COMPOSE_CLIENT_ARCH`: set to Go's `runtime.GOARCH` - `COMPOSE_CLIENT_UID`: set to the current users UID - `COMPOSE_CLIENT_GUID`: set to the current users GID This way, we can now have a Docker Compose setup like this: compose.yaml: ```yaml services: php: image: php volumes: - .:/code user: ${COMPOSE_CLIENT_UID}:${COMPOSE_CLIENT_GID} web: image: apache extends: file: compose.${COMPOSE_CLIENT_OS}.yaml service: web ``` compose.linux.yaml: ```yaml services: web: environment: VIRTUAL_HOST: mysite.local ``` compose.darwin.yaml: ```yaml services: web: environment: VIRTUAL_HOST: mysite.docker ``` Closes docker#11820. Signed-off-by: Arne Jørgensen <arne@arnested.dk>
- Loading branch information