How to Install HandBrake in Docker

  • Post author:WunderTech
  • Post published:January 18, 2023
  • Post last modified:September 19, 2023
  • Post category:Docker
  • Reading time:7 mins read

In this tutorial, we will look at how to install HandBrake in Docker. If you’re ever interested in minimizing the size of your media files, HandBrake is a great way to do it!

What is HandBrake?

HandBrake is an awesome tool that allows you to convert video files manually or by monitoring a folder. After you install HandBrake in Docker, you’ll be able to access a webpage that has all of the HandBrake settings (functions the same as the client application does).

The Docker container we’ll be using is the jlesage/handbrake container and I’ll be using Portainer to manage the installation, though Portainer is not required.

How to Install HandBrake in Docker

As mentioned above, we will look at how to install HandBrake in Docker using Portainer, however, you can use Docker Compose or a Docker Run command if you’d prefer. If you don’t have Portainer installed, you can learn how to install Portainer here on various devices.

1. Open Portainer and select Add Container.

portainer container list.

2. Give the container a Name, then add the jlesage/handbrake image.

portainer container creation for handbrake.

3. Select publish a new network port in the manual network port publishing section and set the host as 5800 and the container as 5800.

portainer port setup.

4. Scroll down to the Volumes section. There are four total volumes that can be created here, though two of them are only required if you’d like automatic video processing.

  1. Mount the /config path in the container section to a location on the host.
  2. Mount the /storage path in the container section to a location on the host.
  3. If you’d like to watch a folder and automatically convert files in it, map the /watch container section to a location on your host that will have videos added.
  4. If you will be mapping a /watch location, map a /output container folder to a location on your host that will house the converted files.
volume setup for handbrake.

5. We will create a few environment variables, but there are a bunch of them that you can add if you’d like. Select Env in Portainer, then Add an Environment Variable. You will have to perform these steps as many times as necessary for the total number of environment variables you would like to use.

  • TZ: Timezone
  • SECURE_CONNECTION: 1
  • VNC_PASSWORD: Password you’ll use to access the web browser version of HandBrake.
environment variable setup for handbrake.

A fourth environment variable may be needed if you’re using the automated video conversion process so that you can select the correct preset to use. There are also countless other environment variables that do various things (one of my favorites is to delete the source file after it’s been converted). View the options here.

6. In the Restart Policy section, set the value to Always so the container automatically restarts.

restart policy for handbrake container.

7. Select Deploy the Container to deploy the container and access it by the IP address of your Docker host and port 5800!

https://[DOCKER_IP]:5800
container deployment.

8. After navigating to the IP address above, you’ll have to enter the password selected in the VNC_PASSWORD environment variable. After you do, you’ll have a fully functional version of HandBrake in a browser, running on Docker!

handbrake in a web browser! how to install handbrake in docker.

9. You can now use HandBrake or modify any of the presets! Please keep in mind that if you want the automatic conversion to use a specific preset, you must modify it in the environment variables in Portainer.

Conclusion: How to Install HandBrake in Docker

This tutorial looked at how to install HandBrake in Docker. Running HandBrake in Docker is my favorite way to run it – mainly because I can automate the process of converting videos by simply monitoring a folder and ensuring that anything inside of it gets converted. It’s a great tool for archiving video files and storing them in a drastically smaller data size. There are also specific settings that can be set which will keep almost all (if not all) of the quality of the video at a drastically smaller file size.

Thanks for checking out the tutorial on how to install HandBrake in Docker. If you have any questions on how to install HandBrake in Docker, please leave a comment!

WunderTech

Frank is an IT professional with 13+ years experience and the creator of WunderTech. He focuses on sharing his experience with others on computer hardware, servers, software, networking, and self-hosted apps. He has a BS in Computer Information Systems and an MBA. Learn more about Frank in his bio.

This Post Has 2 Comments

  1. Chris

    Does it support hardware acceleration?
    Any idea how to enable it in docker?

    1. WunderTech

      Absolutely! Assuming you have the correct hardware, you can get it working. This is how you can do it: https://github.com/jlesage/docker-handbrake#intel-quick-sync-video

      I tested it on a Synology NAS before publishing the article and it worked, though the performance wasn’t good. I am trying to isolate if that’s related to the hardware on the NAS or if it’s not properly working. Hopefully, the article will be updated as soon as I can figure that out!

Comments are closed.