Run Emby with Docker Compose

“Bringing all of your home videos, music, and photos together into one place has never been easier. Your personal Emby Server automatically converts and streams your media on-the-fly to play on any device.” To be fair, that description works if the plan is to either only use Emby from a browser, and it works great this way, or use the application and have a valid license. Either way, it works well from docker without hardware trans-coding as long as the processor is above 3GHz and the content is less than 2k video.

This build is on a USFF computer, so there is no room for a graphics card and this build does not detail hardware trans-coding.

In this post, Emby is installed to a Docker Compose configuration.

0 . Latest updates and prerequisites.

2024.11.24 – First draft, Ubuntu 24.04 Server.

Check back for updates, if you run into trouble. Leave a comment if the post is missing some detail.

Sudo access is required to an existing Linux server. While the post is written for Ubuntu, the magic is in Docker, so just about any Linux distribution will work with minimal digression. An Emby license is required for advanced features otherwise the web browser based interface is actually good. For this post some command-line and user experience is also required.

1 . Install and setup Docker Compose.

At the server, make sure all updates are installed:

sudo apt update -y && sudo apt upgrade -y

Reboot the server and check again for updates until none remain and there are no error conditions.

Install Docker Compose:

sudo apt install docker-compose-v2

Create a space for the service. The media should be on another volume, this tutorial assumes the application is on an SSD in /opt/media and the media is mounted as /mnt/movies, /mnt/music, etc. this is customisable later, though. For now:

sudo mkdir -p /opt/docker/emby

Make sure a sudo equivalent user has full access and ownership of this location. In this case, the user is localadmin with a UID and GUID of “1000”:

sudo chmod 775 /opt/docker/emby -R
sudo chown localadmin:localadmin /opt/docker/emby -R

2 . Deploy the Emby image with some customisation.

Create or update an environment file in the docker location:

sudo nano /opt/docker/.env

The file should contain at least these variables so that they can be applied and reused as necessary, substituting details as required:

TIMEZONE="Europe/Berlin"
PUID="1000"
PGID="1000"
ROOT="/opt/docker"
CERTIFICATES="/opt/sslupdate/certificates"
TEMP="/mnt/temp"
MUSIC="/mnt/music"
FEATURES="/mnt/features"
TVSHOWS="/mnt/tvshows"
EBOOKS="/mnt/ebooks"
AUDIOBOOKS="/mnt/audiobooks"
PODCASTS="/mnt/podcasts"

In the above environment file, the timezone should match where the server is installed. The PUID and GUID match the user that docker runs under, usually a sudo user, from the previous step. The locations are a personal choice, but need to be persistent as Emby regularly scans for changes and runs routine maintenance tasks. The certificates location should contain valid certificates for secure access. Check this post for some details around that.

If at all possible, temp should be as big and fast as possible. A good SSD is no longer cost prohibitive. If at all possible, get a smaller (~400GB) enterprise grade SSD rather than a “hard to believe it’s so cheap” (~2TB) consumer grade SSD. Aim for >400MB/s sustained read and write.

Finally, create or update the docker-compose.yml file:

sudo nano /opt/docker/docker-compose.yml

And have these contents, at a minimum:

services:
  emby:
    image: emby/embyserver
    container_name: emby
    environment:
      - UID=${PUID}
      - GID=${PGID}
      - TZ=${TIMEZONE}
    volumes:
      - ${ROOT}/emby/config:/config
      - ${TEMP}:/mnt/temp
      - ${FEATURES}:/mnt/features
      - ${TVSHOWS}:/mnt/tvshows
      - ${MUSIC}:/mnt/music
      - ${PODCASTS}:/mnt/podcasts
      - ${EBOOKS}:/mnt/ebooks
      - ${AUDIOBOOKS}:/mnt/audiobooks
      - /opt/sslupdate/certificates:/certificates
    ports:
      - 8090:8096
      - 8091:8920
    restart: unless-stopped

networks:
  backend:
    driver: bridge

The container_name is free text, make it simple and easy to understand. The variables are as described in the environment file. In this case, the Emby interface is running on port 8090 or 8091 depending on whether there is a need for secure access, these can be any valid, free ports. Internally.

In recent versions of Docker, it is recommended to create a custom network and not rely on the default network. This network is called “backend”, it can be any name that is appropriate.

3 . Test the deployment.

The download is larger than expected and it might take a few minutes before Emby is running. Start the services and give it about 5 minutes:

cd /opt/docker
docker compose up -d

You should see the initial dialogue setup after a few minutes at the docker host, on the specified port:

At first login, the installer will ask some questions about the environment. The paths for media are defined in the docker-compose.yml file and relevant to the container, not the host server:

This is a simple or complicated setup based on the intended use. It is recommended to make a few changes at a time and compare performance between changes. If the host server has a decent in-built processor with an IGP or a mid-range GPU, hardware trans-coding should be setup. It is the experience of the poster that any video content over 1920×1080 needs a GPU, otherwise a somewhat decent (>3GHz) processor should suffice.

Make sure to assign the trans-coding and temporary folders to the /mnt/temp location otherwise the root disk may fill up, really quickly.

4 . Supporting this blog.

This type of content takes a lot of effort to write. Each post is drafted, researched, then tested multiple times, even a simple step or detail might take more than a few hours to go from the idea to a published blog post.

Did you notice there are no adverts or AI generated content on this site?

If you feel I have saved you some time, you can support me by;

©horsefreeglue.com, 2024. Unauthorized use and/or duplication of this material without express and written permission from this site’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given.

Spread the love
error: Content is protected !!