Bojan Kraut
Bojan Kraut

Reputation: 207

failed to mount local volume

I'm trying to execute docker-compose for this configuration:

version: '3'
services:
    db:
        hostname: db.magento2.docker
        image: mariadb:latest
        environment:
            MYSQL_ROOT_PASSWORD: 'password'
            MYSQL_USER: 'db-user'
            MYSQL_PASSWORD: 'password'
            MYSQL_DATABASE: 'database_name'
        volumes:
            - 'mymagento-magento-sync:/app:delegated'
            - 'mymagento-magento-db:/var/lib/mysql'
        ports:
            - 3306:3306
        networks:
            magento:
                aliases:
                    - db.magento2.docker
volumes:
    mymagento-magento-sync:
        driver_opts:
            type: none
            device: '${PWD}/mymagento-magento-sync'
            o: bind
    mymagento-magento-db: {}
networks:
    magento:
        driver: bridge
    magento-build:
        driver: bridge

When I run docker-compose, I get following message:

Error response from daemon: error while mounting volume '/var/lib/docker/volumes/folder_mymagento-magento-sync/_data': failed to mount local volume: mount mymagento-magento-sync:/var/lib/docker/volumes/folder_mymagento-magento-sync/_data, flags: 0x1000: no such file or directory

I'm relatively new to docker, so I'd appreciate any hint how can I resolve this.

Best, Bojan

Upvotes: 7

Views: 19567

Answers (3)

arifwdn
arifwdn

Reputation: 1

I think your volume folder is not found by docker. So you can restore in recycle bin or delete your volume before.

Check your volume, if your volume is same in your docker-compose.yml, you can delete it. Example :

docker volume rm mymagento-magento-sync

Upvotes: 0

vel
vel

Reputation: 1

docker run -it -d --mount source=<your_website>,target=/var/www/html -d -p 12:22 -d -p 187:80  -d -p 744:443  --restart always --name <container_name_website> <image_name>

mkdir -p /home/your/file/path

docker volume create --name your_website  --opt type=none --opt device=/home/your/file/path --opt o=bind 

Upvotes: 0

Johnson Chen
Johnson Chen

Reputation: 131

  1. step 1: remove and clean your env

    docker-compose -f docker.yml down -v

  2. step 2: reinstall docker-compose

    pip install docker-compose

  3. restart your app

    docker-compose -f docker.yml up -d

Upvotes: 5

Related Questions