Docker for Windows - failed to mount local volume, no such file or directory

2022-11-29T05:12:41

I have the same problem like here Docker - failed to mount local volume, no such file or directory

docker-compose --verbose up -d
[+] Running 0/0
 - Container brickchart-mysql-1  Creating                                                                                                                                                                                          0.0s 
Error response from daemon: failed to mount local volume: mount 
.docker/mysql/data:/var/lib/docker/volumes/brickchart_db_volume/_data, 
flags: 0x1000: no such file or directory

Here is my docker-compose.yml file:

version: '3.9'

services:
  mysql:
    image: mysql:5.7
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: db_name
      MYSQL_USER: db_user
      MYSQL_PASSWORD: db_password
    ports:
      - "3306:3306"
    volumes:
      - db_volume:/var/lib/mysql:delegated

volumes:
  db_volume:
    driver: local
    driver_opts:
      type: 'none'
      o: 'bind'
      device: ./.docker/mysql/data

I have the latest Docker Desktop installed:

enter image description here

I also tested older versions: 4.14.0, 4.12.0 and 4.10.1.

I understand that the docker-compose file is converted to docker commands. A verbose flag would help a lot. Unfortunately, it seems like the verbose flag doesn't exist: https://github.com/docker/compose/issues/1640

It would be great if I can see how

volumes:
  - db_volume:/var/lib/mysql:delegated

will be converted in to docker commands.

Does anybody have any tips for this problem?

Copyright License:
Author:「ThomasL.」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/74606506/docker-for-windows-failed-to-mount-local-volume-no-such-file-or-directory

About “Docker for Windows - failed to mount local volume, no such file or directory” questions

I have the same problem like here Docker - failed to mount local volume, no such file or directory docker-compose --verbose up -d [+] Running 0/0 - Container brickchart-mysql-1 Creating ...
I have a docker-compose that was working for a long time and suddenly stopped. I am getting: failed to mount local volume, no such file or directory This was working for months and started giving ...
I'm trying to run my image like this: version: '3.8' services: gamit: image: myimage volumes: - app:/app volumes: app: driver: local driver_opts: type: none
I'm using docker 1.13.1 in Windows 10 with Hyper-v and I've a volume C:\autotestDocker\plat1>docker inspect plat1_logscore [ { "Driver": "local", "Labels":
I am trying to set up an EMQx broker in the form of deploying it with Docker. One of my constraints is to do this on Windows. To be able to use TLS/SSL authentication there must be a place to put c...
Per Docker documentation relative hosts paths can be used using . and .. notation. For example it states Relative host paths MUST only be supported by Compose implementations that deploy to a local
I want to copy a public directory into a named volume and mount that into all the Nginx containers. This is my docker-compose.yml: version: '3.7' services: # http://localhost:8187/ nginx: ...
I'm trying to start a service with docker-compose up where the volume is referencing ${PWD}/data. The data/ directory does not exist before docker-compose up is run. This causes an exception. I tho...
I'm trying to execute docker-compose for this configuration: version: '3' services: db: hostname: db.magento2.docker image: mariadb:latest environment:
I need to mount a disk using docker-compose. Currently I can assemble using docker service create, this way: docker service create -d \ --name my-service \ -p 8888:80 \ --mount='type=volume,dst...

Copyright License:Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.