Why does docker-compose up not seem to sync volumes

Here is a simplified version of my docker-compose.yml (it’s the volume in buggy-service that does not behave as I expect):

version: '3.4'
services:

  local-db:
    image: postgres:9.6
    environment:
      - DB_NAME=${DB_NAME}
      # other env vars (not important)
    ports:
      - 5432:5432
    volumes:
      - ~/.docker-volumes/${DB_NAME}/postgresql/data:/var/lib/postgresql/data
      - postgresql:/docker-entrypoint-initdb.d

  buggy-service:
    build:
      context: .
      dockerfile: Dockerfile.test
      target: buggy-image
      args:
        # bunch of args (not important)
    volumes:
      - /Users/me/temp:/temp

volumes:

  postgresql:
    driver_opts:
      type: none
      device: /Users/me/postgresql
      o: bind

If I do docker-compose -f docker-compose.yml up -d local-db, I find that /Users/me/postgresql on the host machine (Mac OSX) binds correctly to /docker-entrypoint-initdb.d with content synced.

However, if I do docker-compose -f docker-compose.yml up --build -d buggy-service, followed by docker run -dit --name buggy-container buggy-image (to create and run a container from the image created), the directory /temp within the container is empty, even though /Users/me/temp has stuff inside.

Question: Why is this? What am I missing?

Here’s the stripped down version of Dockerfile.test referenced by buggy-service:

FROM microsoft/dotnet:2.1-sdk-alpine AS buggy-image

# Bunch of ARG definitions (not important)

VOLUME /temp

# other stuff (not important)

ENTRYPOINT ["/bin/bash"]

# Other FROMs

Source: StackOverflow