Skip to content

Docker Walkthrough

This article will walk you through getting Kometa set up and running via Docker. It will cover:

  1. Installing Docker
  2. Retrieving the image
  3. Setting up the initial config file
  4. Setting up a collection file and creating a couple sample collections
  5. Creating a docker container that will keep running in the background

The specific steps you will be taking:

  1. Verify that Docker is installed and install it if not
  2. Use docker to retrieve the Kometa Docker image
  3. Create a directory for your config files and learn how to tell Docker to use it
  4. Gather two things that Kometa requires:
    • TMDb API Key
    • Plex URL and Token
  5. Then, iteratively:
    • use docker to run the image
    • use a text editor to modify a couple of text files until you have a working config file and a single working collection file.

Note that running a Docker container is inherently a pretty technical process. If you are unable or unwilling to learn the rudiments of using Docker, this may not be the tool for you.

If the idea of editing YAML files by hand is daunting, this may not be the tool for you. All the configuration of Kometa is done via YAML text files, so if you are unable or unwilling to learn how those work, you should stop here.

Finally, this walkthrough is intended to give you a basic grounding in how to get Kometa running. It doesn't cover how to create your own collections, or how to add overlays, or any of the myriad other things Kometa is capable of. It provides a simple "Getting Started" guide for those for whom the standard install instructions make no sense; presumably because you've never run a Docker container before.

Prerequisites

Tip

Nearly anywhere you see

something like this

That’s a command you’re going to type or paste into your terminal (OSX or Linux) or Powershell (Windows). In some cases it's displaying output from a command you've typed, but the difference should be apparent in context.

Additionally, anywhere you see this icon:

That's a tooltip, you can press them to get more information.

Important

This walkthrough is going to be pretty pedantic. I’m assuming you’re reading it because you have no idea how to get a Docker container going, so I’m proceeding from the assumption that you want to be walked through every little detail. You’re going to deliberately cause errors and then fix them as you go through it. This is to help you understand what exactly is going on behind the scenes so that when you see these sorts of problems in the wild you will have some background to understand what’s happening. If I only give you the happy path walkthrough, then when you make a typo later on you’ll have no idea where that typo might be or why it’s breaking things.

I am assuming you do not have any of these tools already installed. When writing this up I started with a brand new Windows 10 install.

I'm also assuming you are doing this on a computer, not through a NAS interface or the like. You can do all this through something like the Synology NAS UI or Portainer or the like, but those aren't documented here. This uses the docker command line because it works the same on all platforms.

You may want to take an hour to get familiar with Docker fundamentals with the official tutorial.

DO NOT MAKE ANY CHANGES BELOW if you want this to just work. Don't change the docker image [linuxserver.io will not work for this, for example]; don't change the paths, etc.

Prepare a small test library [optional]

While going through this process, Kometa is going to load the movies in your library, create some collections, and apply some overlays. If you have a large library, this will be very time-consuming.

For learning and testing, you would be well-advised to create a small test library of a reasonable size, where reasonable it probably below a thousand.

The author has a small library of 10 movies that is used for fast tests.

For best results with this walkthrough, your test library will contain:

That will ensure there's something to go into each of the example collections that will be created.

The advantage of the small test library is that it will reduce the time needed to see results. Running some of these default collections against a library of a few thousand movies can take hours, and for iterative testing it's useful to have something that will run in a few minutes or seconds.

You can set up a test library like this using symlinks without copying files.

Starting up your terminal

Since most of this is typing commands into a terminal, you'll need to have a terminal open.

If your Linux system is remote to your computer, connect to it via SSH. That SSH session is the terminal you will be using, so leave it open.

If you are running this on a desktop Linux machine, start up the Terminal application. That window will be the terminal you will type commands into throughout this walkthrough, so leave it open.

Open the Terminal app; this window will be the place you type commands throughout this walkthrough, so leave it open. The Terminal app is in Applications -> Utilities.

You can also use iTerm or some other terminal app if you wish. If you don't know what that means, use Terminal.

Use the Start menu to open PowerShell. This will be the window into which you type commands throughout this walkthrough, so leave it open.

Installing Docker

To run Docker images, you need to have Docker installed. It is not typically installed on new Mac, Linux, or Windows machines.

The Docker install is discussed here: Installing Docker

Once you have Docker installed, test it at the command line with:

[type this into your terminal]

docker run --rm hello-world
You should see something that starts with:
Hello from Docker!
This message shows that your installation appears to be working correctly.
...

If that doesn't work, stop here until you fix that. Diagnosing and repairing Docker install problems is out of the scope of this walkthrough.


Important note on Docker images

This tutorial uses the official image, and you should, too. Don't change kometateam/kometa to the linuxserver.io image or any other; other images may have idiosyncrasies that will prevent this walkthrough from working. The official image will behave exactly as documented below. Others very possibly won't.

The great thing about Docker is that all the setup you'd have to do to run Kometa is already done inside the docker image.

That means we can just jump right into running it. At the command prompt, type:

docker run --rm kometateam/kometa --run

This is going to fail with an error. That's expected.

You should see something like this:

Unable to find image 'kometateam/kometa:latest' locally
latest: Pulling from kometateam/kometa
7d63c13d9b9b: Already exists
6ad2a11ca37b: Already exists
8076cdef4689: Pull complete
0ba90f5a7dd0: Pull complete
27c191df269f: Pull complete
c75e4c0924fa: Pull complete
ed6716577767: Pull complete
0547721ab7a3: Pull complete
ea4d35bce959: Pull complete
Digest: sha256:472be179a75259e07e68a3da365851b58c2f98383e02ac815804299da6f99824
Status: Downloaded newer image for kometateam/kometa:latest
Config Error: config not found at //config

That error means you don’t have a config file, but we know that most everything is in place to run the image.

Setting up a volume map

Kometa, inside that Docker container, can only see other things inside the container. We want to add our own files for config and metadata, so we need to set something up that lets Kometa see files we create outside the container. This is called a "volume map".

Go to your home directory and create a new directory:

[type this into your terminal]

cd ~ #(1)!
mkdir kometa #(2)!
  1. This changes to your home directory, which will be something like /home/yourname or /Users/yourname or C:\Users\YourName depending on the platform.
  2. This creates a directory called "kometa"

cd into that directory and create another directory:

[type this into your terminal]

cd ~/kometa #(1)!
mkdir config #(2)!
  1. This navigates to the kometa folder within your home directory.
  2. This creates a directory called "config"

  3. get the full path:

[type this into your terminal]

pwd

This will display a full path:

/home/YOURUSERNAME/kometa
/Users/YOURUSERNAME/kometa
C:\Users\YOURUSERNAME\kometa

Add "config" onto the end of that to get the host path to your config directory, for example:

/home/YOURUSERNAME/kometa/config
/Users/YOURUSERNAME/kometa/config
C:\Users\YOURUSERNAME\kometa\config

You'll need to add this to the docker command every time you run it, like this:

docker run --rm -it -v "/home/YOURUSERNAME/kometa/config:/config:rw" kometateam/kometa
docker run --rm -it -v "/Users/YOURUSERNAME/kometa/config:/config:rw" kometateam/kometa
docker run --rm -it -v "C:\Users\YOURUSERNAME\kometa\config:/config:rw" kometateam/kometa

If you run that command now it will display a similar error to before, but without all the image loading:

$ docker run --rm -it -v "/Users/mroche/kometa/config:/config:rw" kometateam/kometa --run
Config Error: config not found at //config

Note that I show the example path there.

Why did we create that `config' directory? This was done so that from here on in the instructions match between this walkthrough and the [Local walkthrough](local.md).

Create a directory to quiet an error later

The default config file contains a reference to a directory that will show an error in the output later. That error can safely be ignored, but it causes some confusion with new users from time to time.

We'll create it here so the error doesn't show up later.

[type this into your terminal]

mkdir config/assets

[type this into your terminal]

mkdir config/assets

[type this into your terminal]

mkdir config\assets

Setting up the initial config file

Next you’ll set up the config file. This tells Kometa how to connect to Plex and a variety of other services.

Before you do this you’ll need:

  1. TMDb API key. They’re free.
  2. Plex URL and Token

There are a bunch of other services you can configure in the config file, but these two are the bare minimum.

Getting a TMDb API Key

Note that if you already have an API key, you can use that one. You don’t need another.

Go to https://www.themoviedb.org/. Log into your account [or create one if you don’t have one already], then go to “Settings” under your account menu.

In the sidebar menu on the left, select “API”.

Click to generate a new API key under "Request an API Key". If there is already one there, copy it and go to the next step.

There will be a form to fill out; the answers are arbitrary. The URL can be your personal website, or probably even google.com or the like.

Once you’ve done that there should be an API Key available on this screen. If you see v3 and v4, you want the v3 key.

Copy that value, you’ll need it for the config file.

Getting a Plex URL and Token

The Plex URL is whatever URL you’d use from this machine to connect directly to your Plex server [i.e. NOT app.plex.tv].

As with the TMDb API Key, if you already have a Plex Token, you can use that one.

This article will describe how to get a token: Finding an authentication token

Editing the config template

First, make a copy of the template:

Get a copy of the template to edit [type this into your terminal]:

curl -fLvo config/config.yml https://raw.githubusercontent.com/Kometa-Team/Kometa/master/config/config.yml.template

Get a copy of the template to edit [type this into your terminal]:

curl -fLvo config/config.yml https://raw.githubusercontent.com/Kometa-Team/Kometa/master/config/config.yml.template

Go to this URL using a web browser; choose the "Save" command, then save the file at:

C:\Users\YOURUSERNAME\kometa\config\config.yml

Now open the copy in an editor:

[type this into your terminal]

nano config/config.yml

I’m using nano here mostly because it’s simpler than any other editor on Linux.

If you see something like:

 $ nano config/config.yml
zsh: command not found: nano

You need to install nano, which you would do with:

[type this into your terminal]

sudo apt install nano

You can use any other text editor you wish, provided it saves files as PLAIN TEXT. vi, emacs, etc.

[type this into your terminal]

nano config/config.yml

I’m using nano here simply because it’s built into OSX. You can use any other text editor you wish, provided it saves files as PLAIN TEXT. BBedit, TextMate, VSCode, etc.

A common mistake is using TextEdit.app, which saves files as RTF by default.

[type this into your terminal]

notepad .\config\config.yml
I’m using notepad here simply because it’s built into Windows. You can use any other text editor you wish, provided it saves files as PLAIN TEXT.

From here on in, when this walkthrough says "open the config file", I mean this nano or notepad command. Don't copy the template again.


Scroll down a bit and update the three things you just collected; Plex URL, Plex Token, and TMDb API Key.

plex:                                           # Can be individually specified per library as well
  url: http://bing.bang.boing                <<< ENTER YOUR PLEX URL HERE
  token: XXXXXXXXXXXXXXXXXXXX                <<< ENTER YOUR PLEX TOKEN HERE
  timeout: 60
  db_cache:
  clean_bundles: false
  empty_trash: false
  optimize: false
tmdb:
  apikey: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX   <<< ENTER YOUR TMDb API KEY HERE
  language: en

Now scroll up and look at the top section:

## This file is a template remove the .template to use the file

libraries:                       # This is called out once within the config.yml file
  Movies:                        # Each library must match the Plex library name
    collection_files:
      - default: basic               # This is a file within the defaults folder in the Repository
      - default: imdb                # This is a file within the defaults folder in the Repository
      # see the wiki for how to use local files, folders, URLs, or files from git
    remove_overlays: false       # Set this to true to remove all overlays
    overlay_files:
      - default: ribbon              # This is a file within the defaults folder in the Repository
      # see the wiki for how to use local files, folders, URLs, or files from git
  TV Shows:
    collection_files:
      - default: basic               # This is a file within the defaults folder in the Repository
      - default: imdb                # This is a file within the defaults folder in the Repository
      # see the wiki for how to use local files, folders, URLs, or files from git
    remove_overlays: false       # Set this to true to remove all overlays
    overlay_files:
      - default: ribbon              # This is a file within the defaults folder in the Repository
      # see the wiki for how to use local files, folders, URLs, or files from git
  Anime:
    collection_files:
      - default: basic               # This is a file within the defaults folder in the Repository
      - default: anilist             # This is a file within the defaults folder in the Repository
      # see the wiki for how to use local files, folders, URLs, or files from git
  Music:
    collection_files:
      - file: config/Music.yml   # This is a local file THAT YOU MIGHT CREATE
playlist_files:
  - default: playlist                # This is a file within Kometa's defaults folder
  # see the wiki for how to use local files, folders, URLs, or files from git

You will ultimately need an entry here for each of the libraries on which you want Kometa to act. Those top-level elements [Movies, TV Shows, Anime, Music] are names of libraries on your Plex server.

For now, delete the “TV Shows”, “Anime”, and "Music" sections from the config file and change the name of the “Movies” section to “Movies-NOSUCHLIBRARY":

The top bit of your config file should now look like this:

libraries:
  Movies-NOSUCHLIBRARY:                         ## <<< CHANGE THIS LINE
    collection_files:
      - default: basic               # This is a file within the defaults folder in the Repository
      - default: imdb                # This is a file within the defaults folder in the Repository
      # see the wiki for how to use local files, folders, URLs, or files from git
playlist_files:
  - default: playlist                # This is a file within Kometa's defaults folder
  # see the wiki for how to use local files, folders, URLs, or files from git

This is intended to cause an error for illustration that you will then fix.

Be very careful with the indentation and ensure it looks exactly like the above; each line indented using two spaces, NOT TABS, with playlist_files: all the way over on the left. Indentation is significant in YAML.

Testing the config file

Save the file:

If you're using nano, type control-x, then y, then the enter key.

If you're using nano, type control-x, then y, then the enter key.

If you're using notepad, type control-s or choose Save from the File menu.

Then run Kometa again:

[type this into your terminal]

docker run --rm -it -v "KOMETA_PATH_GOES_HERE:/config:rw" kometateam/kometa --run

I’ve removed some of the lines for space, but have left the important bits:

...
|                                            Starting Run|
...
| Locating config...
|
| Using /Users/mroche/Kometa/config/config.yml as config
...
| Connecting to TMDb...
| TMDb Connection Successful
...
| Connecting to Plex Libraries...
...
| Connecting to Movies-NOSUCHLIBRARY Library...                                                      |
...
| Plex Error: Plex Library Movies-NOSUCHLIBRARY not found                                            |
| Movies-NOSUCHLIBRARY Library Connection Failed                                                     |
|====================================================================================================|
| Plex Error: No Plex libraries were connected to                                                    |
...

You can see there that Kometa found its config file, was able to connect to TMDb, was able to connect to Plex, and then failed trying to read the “Movies-NOSUCHLIBRARY" library, which of course doesn’t exist.

Open the config file again and change "Movies-NOSUCHLIBRARY" to reflect your own Movie library in Plex.

Say my Movies library is called “All The Movies", so mine looks like this:

libraries:
  All The Movies:                            ## <<< CHANGE THIS LINE
    collection_files:
      - default: basic               # This is a file within the defaults folder in the Repository
      - default: imdb                # This is a file within the defaults folder in the Repository
      # see the wiki for how to use local files, folders, URLs, or files from git

At this point, the top bit of your config file should look like this:

libraries:
  THE_NAME_OF_YOUR_MOVIE_LIBRARY:         ## <<< CHANGE THIS LINE
    collection_files:
      - default: basic               # This is a file within the defaults folder in the Repository
      - default: imdb                # This is a file within the defaults folder in the Repository
      # see the wiki for how to use local files, folders, URLs, or files from git
playlist_files:
  - default: playlist                # This is a file within Kometa's defaults folder
  # see the wiki for how to use local files, folders, URLs, or files from git

Where THE_NAME_OF_YOUR_MOVIE_LIBRARY has been replaced by the name of your movie library as shown in Plex ["All The Movies" here]:

movie-lib-name

Creating a few sample collections

Kometa provides an extensive collection of "default" collection files.

These files provide a simple way for you to create collections based on franchises or awards or actors, etc.

The default config links to two of them, these two lines in your config file:

libraries:
  THE_NAME_OF_YOUR_MOVIE_LIBRARY:
    collection_files:
      - default: basic               # <<< THIS LINE
      - default: imdb                # <<< THIS LINE
playlist_files:
  - default: playlist

The first will create:

  • Newly Released
  • New Episodes [TV libraries only]

The second will create:

  • IMDb Popular
  • IMDb Top 250
  • IMDb Lowest Rated

So let's run Kometa and see this happen:

[type this into your terminal]

docker run --rm -it -v "KOMETA_PATH_GOES_HERE:/config:rw" kometateam/kometa --run

Depending on the size of the library, this may take a while.

As it builds the collections, you should see a fair amount of logging about which movies are being added and which ones aren’t found. Once it completes, go to Plex, go to your Movies library, and click “Collections” at the top.

On my test library, this created four collections. You may see fewer depending on what specific movies are in that library.

default-collections

Perhaps you can do everything you want in terms of collections [award collections, actor collections, genre collections, franchise collections, etc] with the defaults. You can investigate what they can provide under the "Defaults" heading at the top of this wiki.

Setting up a collection file and creating a few sample collections

If the default collection files do not allow you to create the collections you want, you can define your own collections in your own collection files to do whatever you like within the capabilities of Kometa. We will create a simple collection that will contain 20 comedy movies released since 2012.

First, open the collection file [this will create the file if it doesn't already exist]:

[type this into your terminal]

nano "config/Movies.yml"

[type this into your terminal]

nano "config/Movies.yml"

[type this into your terminal]

notepad "config\Movies.yml"

In this file, add the following, exactly as it is shown here; remember that spacing is significant in YAML files:

collections:
  Recent Comedy:
    plex_search:
      all:
        genre: Comedy
        year.gte: 2012
      limit: 20

Save the file:

If you're using nano, type control-x, then y, then the enter key.

If you're using nano, type control-x, then y, then the enter key.

If you're using notepad, type control-s or choose Save from the File menu.

Next, add a reference to this file to your config file.

Open the config file again and add the last line shown below:

libraries:
  All The Movies:
    collection_files:
      - default: basic
      - default: imdb
      # see the wiki for how to use local files, folders, URLs, or files from git
      - file: config/Movies.yml     ## <<< ADD THIS LINE

That line needs to match the path you used when you created the file a moment ago. If you are copy-pasting these commands, it does.

Save the file:

If you're using nano, type control-x, then y, then the enter key.

If you're using nano, type control-x, then y, then the enter key.

If you're using notepad, type control-s or choose Save from the File menu.

Then run Kometa again:

[type this into your terminal]

docker run --rm -it -v "KOMETA_PATH_GOES_HERE:/config:rw" kometateam/kometa --run

You should see that the collection file gets loaded:

| Loading Collection File: config/Movies.yml
| Collection File Loaded Successfully

As it builds the collection, you should see a fair amount of logging about which movies are being added and which ones aren’t found. Once it completes, go to Plex, go to your Movies library, and click “Collections” at the top.

You should see the new collection:

Finished Collections

When you click into each, you’ll see the movies that Kometa added to each collection.

Each time you run the script, new movies that match the collection definitions will be added. For example, if you don’t have “The ShawShank Redemption” now, when you download it and run Kometa again it will be added to the IMDB 250 collection.

Adding Overlays to movies

The default collection files include a set of overlays you can add to your posters.

We'll add resolution overlays to the movies in this library as an example.

Open the config file again and add the last three lines shown below:

libraries:
  All The Movies:
    collection_files:
      - default: basic               # This is a file within the defaults folder in the Repository
      - default: imdb                # This is a file within the defaults folder in the Repository
      # see the wiki for how to use local files, folders, URLs, or files from git
      - file: config/Movies.yml
    remove_overlays: false            ## <<< ADD THIS LINE
    overlay_files:                         ## <<< ADD THIS LINE
      - default: resolution                   ## <<< ADD THIS LINE

Save the file:

If you're using nano, type control-x, then y, then the enter key.

If you're using nano, type control-x, then y, then the enter key.

If you're using notepad, type control-s or choose Save from the File menu.

Then run Kometa again:

[type this into your terminal]

docker run --rm -it -v "KOMETA_PATH_GOES_HERE:/config:rw" kometateam/kometa --run

While it runs this time you should see the previous collections go by pretty quickly, since they aren't changing, and then a lot of logging as Kometa decides which overlays apply to which movies.

This may take quite a while depending on the size of this library.

Eventually, you'll see it start applying overlays to all your movies:

|=========================================================|
|    Applying Overlays for the All The Movies Library     |
|=========================================================|
|                                                         |
| 10 Cloverfield Lane         | Overlays Applied: 4K-HDR  |
| 10 Minutes Gone             | Overlays Applied: 4K-HDR  |
| 10 Things I Hate About You  | Overlays Applied: 4K-HDR  |
| 12 Mighty Orphans           | Overlays Applied: 4K-HDR  |
| 12 Monkeys                  | Overlays Applied: 4K-DV   |
| 12 Strong                   | Overlays Applied: 4K-HDR  |
...

When it finishes, go to the Library tab in this library in Plex:

Overlaid posters

What comes next:

If you want to remove those overlays, open the config file, change the value of remove_overlays to true, and rerun Kometa.

    remove_overlays: true
    overlay_files:
      - default: resolution

If you want to remove those collections, open the config file, remove or comment out [add # to the beginning] any or all of those lines under collection_files, and delete the collections manually from Plex.

libraries:
  All The Movies:
    collection_files:
      # - default: basic               # This is a file within the defaults folder in the Repository
      # - default: imdb                # This is a file within the defaults folder in the Repository
      # see the wiki for how to use local files, folders, URLs, or files from git
      # - file: config/Movies.yml
    remove_overlays: false
    overlay_files:
      - default: resolution

Edit Movies.yml to reflect the actions you want Kometa to perform on your libraries.

TV Shows and other libraries work the same way as you've seen above. Create a section under libraries: in the config.yml, refer to default files or create a collection file, define collections, run the script.

Investigate the rest of the wiki to learn about everything Kometa can do for you.

Runtime and Environment Flags

The command in this walkthrough will run all collections and libraries immediately. If you want to modify that behavior to run just one or some collections, or just one library, or just overlays or the like, review the Run Commands & Environment Variables.

Creating Collections, Overlays, Playlists, etc.

These things are all generally defined in collection files that are referred to in the config file. The starting point for creating these files is here.

Other Topics

Scheduling

The commands you've been using in this walkthrough run Kometa immediately then quit.

Kometa also features multiple layers of scheduling, which you can leverage to control when various activities take place.

  • You can run Kometa in the background, telling it to wake up and process your libraries at fixed times during the day. The default behavior in this regard is to wake up at 5AM and process the config. If you leave the -r off the commands you have been using in this walkthrough, that's what will happen.

You can control when Kometa wakes up with the time-to-run env-var/runtime flag.

  • You can skip using that internal schedule and just do manual runs as you have been doing throughout this walkthrough using standard tools available in your OS.

Details on setting this up are found here.

  • In addition, individual items within the configuration can be scheduled to take place at certain times provided Kometa is running at that time. For example, you can tell Kometa only to apply overlays on Tuesdays or the like. You can then schedule manual runs every day at noon and overlays will only get processed when it runs on Tuesday. This sort of schedule will not make Kometa start up if it is not already running. If you don't arrange for Kometa to be run on Tuesday, your overlays would never be processed in this example.

Details on this level of scheduling are found here

I want to use the develop branch

Add the develop tag to the image name in your run command [or wherever you specify the image in your environment]

docker run --rm -it -v "KOMETA_PATH_GOES_HERE:/config:rw" kometateam/kometa:develop --run
                                                                                                  ^^^^^^^

This may not work if you are not using the official image.

I want to use the nightly branch

Add the nightly tag to the image name in your run command [or wherever you specify the image in your environment]

docker run --rm -it -v "KOMETA_PATH_GOES_HERE:/config:rw" kometateam/kometa:nightly --run
                                                                                                  ^^^^^^^

This may not work if you are not using the official image.

I want to ensure I am using the master branch

Add the latest tag to the image name in your run command [or wherever you specify the image in your environment]

docker run --rm -it -v "KOMETA_PATH_GOES_HERE:/config:rw" kometateam/kometa:latest --run
                                                                                                  ^^^^^^