4

Is there any way to ignore some files or directories within volume of type bind-mount?

I would like to ignore for example all bin and obj directories within my solution. The issue is that I have dozens of bin and obj folders in my project. I have tried with glob pattern but is seems not working with yaml files.

version: '3.8'
services:
  service-1:
    image: some-img:latest
    container_name: some-name
    build:
      context: ../
      dockerfile: ./docker/Dockerfile
    volumes:
    - ../src/:/app/src/ # bind-mount
    - /app/src/project1/bin # AS-IS
    - /app/src/project1/obj # AS-IS
    - /app/src/project2/bin # AS-IS
    - /app/src/project2/obj # AS-IS
    - /app/src/*/bin # TO-BE (not working)
    - /app/src/*/obj # TO-BE (not working)
    - '/app/src/*/obj' # TO-BE (not working)
Mikolaj
  • 1,231
  • 1
  • 16
  • 34
  • Does this answer your question? [Add a volume to Docker, but exclude a sub-folder](https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder) – AymDev May 06 '22 at 10:03
  • 1
    Unfortunately no. I know how to ignore single file/directory by typing their path explicitly, but I would like to know how to ignore all specific files/directories without typing them explicitly. For exmaple ignore all bin folders from entire project – Mikolaj May 06 '22 at 10:16

0 Answers0