Home:ALL Converter>docker failed to mount local volume mount no such file or directory

docker failed to mount local volume mount no such file or directory

Ask Time:2022-03-31T00:19:15         Author:r69

Json Formatter

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
      device: ./app
      o: bind

At first my goal was to have an app directory near my docker-compose.yml file that (app directory) should persist an app directory from inside a container (it already contains some important data). My deploy scenario assumes that this directory is initially empty on host and then keeps up with changes from inside container. When I was running it with docker compose up my app directory near the docker-compose.yml remained empty. I noticed that /var/lib/docker/volumes/myimage/_data was created and populated with data from container (I assumed from another stackoverflow questions that my device: ./app option sets the location of host directory). Then I've removed /var/lib/docker/volumes/myimage/ directory and now it throws me an error docker failed to mount local volume mount no such file or directory. My general goal is to initially run docker compose up with an empty app directory, populate it from inside the container and then have all changes from inside the container in it.

Author:r69,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/71680749/docker-failed-to-mount-local-volume-mount-no-such-file-or-directory
yy