Skip to content

Instantly share code, notes, and snippets.

@dhsathiya
Created February 21, 2022 19:12
Show Gist options
  • Save dhsathiya/f4af341a5a20b005d73f34e8d33fa064 to your computer and use it in GitHub Desktop.
Save dhsathiya/f4af341a5a20b005d73f34e8d33fa064 to your computer and use it in GitHub Desktop.

Dockerfile

FROM node:lts

ARG UID=1001
ARG GID=1001

RUN echo "######### $UID"
RUN echo "######### $GID"

docker-compose.yml

version: '3.5'

services:
  nest:
    build:
      context: ./dockerfiles/nest
      args:
        UID: ${UID:-1000}
        GID: ${GID:-1000}
docker-compose build --build-arg UID="1003" --build-arg GID="1003" --no-cache

By this, UID will be 1003 and GID will be 1003

  • .env is not working

  • export $UID with shell script not working

  • ARG UID=1005 not working

  • compose-file GID: ${GID:-1000} is working

  • build-arg is working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment