How do you mount an external drive to use in Docker compose for Plex media data?

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:

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.

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
1 Like

Thanks for the reply.

Can you give an example of how to set a bind mount? I’m also looking at the Docker documents.

bind-mount = mount local folder in container.
example is in my previous post :wink:

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 :+1:

Would this be correct?

-  /media/ext4tb/tv:/media/tv:ro

just try it :wink:
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.

1 Like

I’ve swapped over from Windows 11 to Ubuntu. Docker is so easy on Ubuntu compared with Windows WSL2. Thanks for your help.