Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

928
Views
Docker container tries to mount a directory that is a file

I am building craft cms in docker and I am getting the following error, when I execute docker-compose up:

ERROR: for craftcms Cannot start service craftcms: OCI runtime create failed: container_linux.go:344: starting container process caused "process_linux.go:424: container init caused \"rootfs_linux.go:58: mounting \\"/host_mnt/c/src/composer.lock\\" to rootfs \\"/var/lib/docker/overlay2/b7084475699f911f17d38746b21b1b9694fedf6e096a4080109d429fa687a6db/merged\\" at \\"/var/lib/docker/overlay2/b7084475699f911f17d38746b21b1b9694fedf6e096a4080109d429fa687a6db/merged/var/www/composer.lock\\" caused \\"not a directory\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type ERROR: Encountered errors while bringing up the project.

Apparently, mounting directories in Windows OS is different than Linux OS. Could you please help me troubleshoot this?

enter image description here

UPDATE

From the docker-compose.yml, this is where I mount the files:

craftcms:
    build:
      context: .
      dockerfile: ./infrastructure/docker/php-fpm/Dockerfile
    expose:
      - 9000
    volumes:
      - cpresources:/var/www/web/cpresources
      - ./src/vendor:/var/www/vendor
      - ./src/composer.json:/var/www/composer.json
      - ./src/composer.lock:/var/www/composer.lock
      - ./src/config:/var/www/config
      - ./src/modules:/var/www/modules
      - ./src/templates:/var/www/templates
      - ./src/web:/var/www/web
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

This typically indicates that src/composer.lock is either not a file, or that the drive where these files exist is not properly shared to the docker VM.

For the former, check the directory where you are running docker-compose from, this is the censored directory so I cannot provide you better details than that. You should have a src\composer.lock in there as a regular file, not a directory.

For the latter, go into the docker preferences, and reconfigure the drive sharing to ensure the drive with your compose project is included, and that docker has your current password (it performs a windows SMB mount to share the drive to the docker VM).

When docker tries to mount a file that does not exist as a host mount, the default action is to create a directory on the host (this may be only in the docker VM if the directory is not properly shared) and mount that directory inside the container. And if that is supposed to be a file instead of a directory inside the container, you will get an error.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!