Search code examples
dockerdocker-composedocker-desktopmounted-volumes

Docker - "Error while mounting volume - no route to host" - Cannot access my local network from my docker container


Hello and thank you in advance for any help.

I have an issue whereby my volumes cannot be mounted when I run my docker-compose file. This is for the 'Audiobookshelf' container. The frustrating thing is that this has been working fine for about 8-10 months, including taking the container down to update. My host is a Windows box, running Docker Desktop.

The command I am issuing to create the drive is:

 docker volume create --driver local --opt type=cifs --opt device=//192.168.1.200/media/books --opt o=user=<username>,password=<password> books

I am also issuing the same command, but with the 'podcast' location and mount points.

My docker compose files is:

services:

audiobookshelf-0114:
    image: ghcr.io/advplyr/audiobookshelf:latest
    ports:
      - 13378:80
    restart: unless-stopped
    volumes:
      - books:/audiobooks
      - podcasts:/podcasts
      - "/c/docker/audiobookshelf/config:/config"
      - "/c/docker/audiobookshelf/metadata:/metadata"
volumes:
  books:
    external: true 
  podcasts:
    external: true 

However, when I issue the 'docker-compose up -d' command I now get this error:

Error response from daemon: error while mounting volume '/var/lib/docker/volumes/books/_data': failed to mount local volume: mount //192.168.1.200/media/books:/var/lib/docker/volumes/books/_data, data: user=********,password=********: no route to host

The two shares are accessible from the windows host running the docker engine.

I am guessing that there is an issue with the networks. If I 'exec' into the container and try and ping 192.168.1.200 or 192.168.1.1 all packets are lost. I am able to get out to the internet and I can connect to the container (if I don't try and mount anything) through the exposed port.

I am not the most experienced with both docker and networks, so any help here will be gratefully received. As I said, this has been working fine. I am not sure if Windows updated and restarted without my knowledge...


Solution

  • After more research, I found this response post from @Ashok who suggested to "remove the other bridged network other than the default one and try to pull the image again". I did just that and 'hay presto', I am back working again.

    The element that caused me misdirection was that error "no route to host". My understanding was that, by default, you can't access your physical network from a bridge adaptor. I guess that if you 'create a volume' then these rules don't apply...

    Anyhow, I hope both Ashok's answer and my follow up will help others...

    Regards, Harold