'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



Solution 1:[1]

  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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Johnson Chen