I’m just seeking out some advice and examples.
I’m moving from docker Desktop on Windows to Docker on Ubuntu. And I’m just wondering how to mount an external drive to use in Docker compose for Plex media data.
Any advice, or examples, is welcome and appreciated.
I was given this as an example, but it confused me:
I have an external drive mounted on the following path
/media/pi/mydrive
I am trying to make this external drive as my named volume container to store the data. The application stores as all the data in /var/www/html/
I am guessing I have to create a volume container for the external drive and attach the same when I running the application container. I normally follow the below format . I am lost on how to make this happen in this case. Any help is appreciated.
docker create -v <volume.nam…
Let’s say I have an external Drive at /media/usb1
How do I mount this for a container to use in Docker Compose?
Any help is appreciated.
albundy33
(Albundy33)
January 7, 2024, 9:57pm
2
you can use bind-mounts.
my trimmed docker-compose.yml
looks like this
version: '3'
services:
plex:
container_name: plex
image: plexinc/pms-docker:latest
hostname: docker_plex
restart: always
ports:
- 32400:32400/tcp
- 3005:3005/tcp
- 8324:8324/tcp
- 32469:32469/tcp
# - 1900:1900/udp
- 32410:32410/udp
- 32412:32412/udp
- 32413:32413/udp
- 32414:32414/udp
devices:
- /dev/dri:/dev/dri
environment:
- TZ=Europe/Berlin
- 'ADVERTISE_IP=http://192.168.1.111:32400/'
volumes:
- ./plex-config:/config
- /media/music:/media/music:ro
- /media/photo:/media/photo:ro
- /media/recordings:/media/recordings:ro
- /media/video:/media/video:ro
2 Likes
albundy33:
bind-mounts
Thanks for the reply.
Can you give an example of how to set a bind mount? I’m also looking at the Docker documents.
albundy33
(Albundy33)
January 8, 2024, 5:45pm
4
bind-mount = mount local folder in container.
example is in my previous post
volumes:
- /media/music:/media/music:ro
This mounts /media/music read-only (ro) from my docker-host as /media/music inside the container.
First folder is the host-folder and the second one the container-folder.
1 Like
Ok. I see. Thank you for explaining. I’ve still got a long way to go before I’m confident with Docker
Would this be correct?
- /media/ext4tb/tv:/media/tv:ro
albundy33
(Albundy33)
January 12, 2024, 5:11pm
7
just try it
but looks correct if the folders exists.
you can also open a shell inside the container to check /media/tv
there are also amlot of good videos an youtube about volumes.
2 Likes
I’ve swapped over from Windows 11 to Ubuntu. Docker is so easy on Ubuntu compared with Windows WSL2. Thanks for your help.
nickb003
(Nickolas Barrett)
August 30, 2024, 8:08pm
9
I have tried almost every variation of lines to mount my NAS that is mounted onto my PC hosting the Docker for calibre-web and am still unable to get out of the VM it creates. Sorry if this is a dumb issue I am running into, but is there something I’m missing for giving Docker applications access to folders outside of the VM? I have run into this issue with multiple different Docker programs and would appreciate any help.
nickb003
(Nickolas Barrett)
August 30, 2024, 8:13pm
10
Here is my docker compose for reference.
calibre-web:
image: lscr.io/linuxserver/calibre-web:latest
container_name: calibre-web
environment:
- PUID=1000
- PGID=1000
- TZ=America/Edmonton
- DOCKER_MODS=linuxserver/mods:universal-calibre #optional
- OAUTHLIB_RELAX_TOKEN_SCOPE=1 #optional
volumes:
- /Docker/homarr/calibre-web:/config
- /libraries/books/calibre:/books
ports:
- 8083:8083
restart: unless-stopped
I have also tried such variations of mounting as
/M:/libraries/books/calibre:/books
/m/libraries/books/calibre:/books
./libraries/books/calibre:/books
None of these allow me to access the folder I tried mounting when selecting my library in Calibre-Web (Windows 11 btw).
Apologies again, I am very much a novice at any kind of coding and working with this stuff is all quite new to me.
albundy33
(Albundy33)
August 30, 2024, 8:55pm
11
have you tried?
- M:/libraries/books/calibre:/books
or maybe
- "M:/libraries/books/calibre:/books"
try also to run
docker compose exec calibre-web ls -l /books
this should list the files if the mount was successful.
check also: Just installed docker desktop for windows , do not see many of the options like shared folder - #3 by alexk345
and: Docker -Cannot see option to Share Drives in Settings -Windows 10 Home · Issue #7199 · docker/for-win · GitHub