Skip to content

# Docker

Tip

If you're new to dockers and want a easy setup I suggest to take a look at DockSTARTer. I've also created a short guide HERE where I explain the settings for the most used applications.

The main goal of DockSTARTer is to make it quick and easy to get up and running with Docker. You may choose to rely on DockSTARTer for various changes to your Docker system or use DockSTARTer as a stepping stone and learn to do more advanced configurations.

DockSTARTer was actually my first steps in to the world of dockers.

Note

I'm not going to explain how to get dockers installed and running, I will only explain which folder structure we recommend.

The paths mentioned below refer to internal paths for the containers!

External paths depends where you mounted your share or your drives.

For example `/<path_to_data>/data`, or even `/data`.

## Folder Structure

Attention

It doesn't really matter which path you use for your media and appdata,

the only thing you should avoid is `/home`.

Because user folders in `/home` are expected to have some restrictive permissions.

It just could end up creating a permissions mess, so it's better to just avoid entirely.

For this example we're going to make use of a share called `data`.

The `data` folder has sub-folders for `torrents` and `usenet` and each of these have sub-folders for `tv`, `movie` and `music` downloads to keep things neat. The `media` folder has nicely named `TV`, `Movies` and `Music` sub-folders, this is your library and what you’d pass to Plex, Emby or JellyFin.

In this examples I'm using lower case on all folder on purpose, being Linux is case sensitive.

    data
    ├── torrents
    │  ├── movies
    │  ├── music
    │  └── tv
    ├── usenet
    │  ├── movies
    │  ├── music
    │  └── tv
    └── media
       ├── movies
       ├── music
       └── tv

The default path setup suggested by some docker developers that encourages people to use mounts like `/movies`, `/tv` and `/downloads` is very suboptimal and it makes them look like two or three file systems, even if they aren’t (Because of how Docker’s volumes work). It is the easiest way to get started. While easy to use, it has a major drawback. Mainly losing the ability to hardlink or instant move, resulting in a slower and more I/O intensive copy + delete is used.

### Breakdown of the Folder Structure

#### Torrent clients

qBittorrent, Deluge, ruTorrent

The reason why we use `/data/torrents` for the torrent client is because it only needs access to the torrent files. In the torrent software settings, you’ll need to reconfigure paths and you can sort into sub-folders like `/data/torrents/{tv|movies|music}`.

    data
    └── torrents
       ├── movies
       ├── music
       └── tv

#### Usenet clients

NZBGet or SABnzbd

The reason why we use `/data/usenet` for the usenet client is because it only needs access to the usenet files. In the usenet software settings, you’ll need to reconfigure paths and you can sort into sub-folders like `/data/usenet/{tv|movies|music}`.

    data
    └── usenet
       ├── movies
       ├── music
       └── tv

#### The Starr Apps

Sonarr, Radarr and Lidarr

Sonarr, Radarr and Lidarr gets access to everything because the download folder(s) and media folder will look like and be one file system. Hard links will work and moves will be atomic, instead of copy + delete.

    data
    ├── torrents
    │  ├── movies
    │  ├── music
    │  └── tv
    ├── usenet
    │  ├── movies
    │  ├── music
    │  └── tv
    └── media
       ├── movies
       ├── music
       └── tv

#### Media Server

Plex, Emby, JellyFin and Bazarr

Plex, Emby, JellyFin and Bazarr only needs access to your media library, which can have any number of sub folders like Movies, Kids Movies, TV, Documentary TV and/or Music as sub folders.

    data
    └── media
       ├── movies
       ├── music
       └── tv

Don't forget to look at the Examples how to setup the paths inside the applications.

### Permissions

Recursively chown user and group and Recursively chmod to 775/664

    sudo chown -R $USER:$USER /data
    sudo chmod -R a=,a+rX,u+w,g+w /data

## Docker-compose Example

This is a docker-compose example based on a default Ubuntu install.

The storage location used for the host is actually the same as in the container to make it easier to understand in this case `/data`.

The appdata (`/config`) will be stored on the host in the `/docker/appdata/{appname}`

docker-compose - [CLICK TO EXPAND]

    version: "3.2"
    services:
      radarr:
        container_name: radarr
        image: cr.hotio.dev/hotio/radarr:latest
        restart: unless-stopped
        logging:
          driver: json-file
        network_mode: bridge
        ports:
          - 7878:7878
        environment:
          - PUID=1000
          - PGID=1000
          - TZ=Europe/Amsterdam
        volumes:
          - /etc/localtime:/etc/localtime:ro
          - /docker/appdata/radarr:/config
          - /data:/data
      sonarr:
        container_name: sonarr
        image: cr.hotio.dev/hotio/sonarr:latest
        restart: unless-stopped
        logging:
          driver: json-file
        network_mode: bridge
        ports:
          - 8989:8989
        environment:
          - PUID=1000
          - PGID=1000
          - TZ=Europe/Amsterdam
        volumes:
          - /etc/localtime:/etc/localtime:ro
          - /docker/appdata/sonarr:/config
          - /data:/data
      bazarr:
        container_name: bazarr
        image: cr.hotio.dev/hotio/bazarr:latest
        restart: unless-stopped
        logging:
          driver: json-file
        network_mode: bridge
        ports:
          - 6767:6767
        environment:
          - PUID=1000
          - PGID=1000
          - TZ=Europe/Amsterdam
        volumes:
          - /etc/localtime:/etc/localtime:ro
          - /docker/appdata/bazarr:/config
          - /data/media:/data/media
      sabnzbd:
        container_name: sabnzbd
        image: cr.hotio.dev/hotio/sabnzbd:latest
        restart: unless-stopped
        logging:
          driver: json-file
        network_mode: bridge
        ports:
          - 8080:8080
          - 9090:9090
        environment:
          - PUID=1000
          - PGID=1000
          - TZ=Europe/Amsterdam
        volumes:
          - /etc/localtime:/etc/localtime:ro
          - /docker/appdata/sabnzbd:/config
          - /data/usenet:/data/usenet:rw

### Docker-Compose Commands

docker-compose commands - [CLICK TO EXPAND]

- `sudo docker-compose up -d` (This Docker-compose command helps builds the image, then creates and starts Docker containers. The containers are from the services specified in the compose file. If the containers are already running and you run docker-compose up, it recreates the container.)
- `sudo docker-compose pull` (Pulls an image associated with a service defined in a docker-compose.yml)
- `sudo docker-compose down` (The Docker-compose down command also stops Docker containers like the stop command does. But it goes the extra mile. Docker-compose down, doesn’t just stop the containers, it also removes them.)
- `sudo docker system prune -a --volumes --force` (Remove all unused containers, networks, images (both dangling and unreferenced), and optionally, volumes.)

Questions or Suggestions?

If you have questions or suggestions click the chat badge to join the Discord Support Channel where you can ask your questions directly and get live support.

Last update: August 17, 2022 18:53:48
Back to top