Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

918
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda