title: Interpolating the value of a build arg in docker-compose.yml
body: <p>I am attempting to use the docker-compose.yml from the Rails example on the Docker site. This is a Windows (WSL2/Ubuntu/Docker Desktop) machine, so any files created in the docker container are owned by root. I am trying to pass my user id and group id as args, but I can't figure out a syntax that will let me:</p>
  <pre><code>version: &quot;3.9&quot;
  services:
    db:
      image: postgres
      volumes:
        - ./tmp/db:/var/lib/postgresql/data
      environment:
        POSTGRES_PASSWORD: password
    web:
      build:
        context: .
        args:
          - USER_ID=$(id -u)
          - GROUP_ID=$(id -g)
      command: bash -c &quot;rm -f tmp/pids/server.pid &amp;&amp; bundle exec rails s -p 3000 -b '0.0.0.0'&quot;
      volumes:
        - .:/myapp
      ports:
        - &quot;3000:3000&quot;
      depends_on:
        - db
  </code></pre>