October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
24/7 streaming

How to Use Docker Compose to Run a 24/7 YouTube Stream on Hetzner

Run a YouTube encoder on a Hetzner Cloud server with Docker Compose, then test stream health, protect your key, and plan recovery beyond container restarts.

By VGSources Team 6 min read
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can run a YouTube encoder on a Hetzner Cloud server with Docker Compose by putting the encoder in a service, supplying a video source and YouTube stream credentials, and starting it with a restart policy. That keeps the process independent of your home computer, but a container restart alone does not guarantee that YouTube is receiving healthy video. The guide below covers setup, protection, validation, and the limits of a continuous stream.

What this setup does—and what it does not

Docker Compose defines and manages the encoder container on a Hetzner server. The server runs the playback or encoding process and sends its output to YouTube Live. Compose can restart a stopped container, while persistent mounts can keep media and configuration available when a container is replaced.

This is not, by itself, an end-to-end availability guarantee. A process can remain running while its source is frozen, its stream key is invalid, or YouTube is not receiving usable video. A restart policy also does not provide an independent backup encoder.

1. Prepare YouTube Live

  1. Check that the channel is verified, live streaming is enabled, and the channel has had no live-streaming restriction in the past 90 days. YouTube says first-time activation can take up to 24 hours. See YouTube’s live-streaming activation guidance.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
    #1 Best Overall
    Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
    • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
    • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
    • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
    • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
    • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
  2. In YouTube Studio, create or select a stream and copy its server URL and stream key into the encoder’s configuration. YouTube’s encoder setup guidance describes the stream URL and key.

  3. Treat the stream key like a password. Do not commit it to a repository, include it in a publicly shared Compose file, or print it in logs. If exposed, reset it through Live Control Room; YouTube documents the relevant stream settings and key controls.

2. Create a Hetzner Cloud server

Hetzner documents a Docker CE app that includes Docker and the Compose plugin, using Ubuntu 24.04 as its base image. Check the app image and its current details when creating a server, since they may change. Alternatively, install Docker and Compose using their current official instructions. See Hetzner’s Docker CE app documentation.

There is no established universal server size for this workload. Encoding demands depend on the source, output resolution and frame rate, codec, and filters. Start with a configuration you can monitor and test using the actual content and output settings rather than assuming a fixed CPU or memory requirement. No workload-specific Hetzner price is established here.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

3. Define the Compose service

Create a Compose file with an encoder service, a deliberately managed image tag, an explicit encoder command, a restart policy, and mounts for media or configuration that must survive container replacement. The example below shows structure only; it is not a tested, ready-to-run encoder configuration. Replace the image, command, paths, and credential handling with values supported by your chosen encoder.

services:
  streamer:
    image: your-encoder-image:your-pinned-tag
    restart: unless-stopped
    volumes:
      - ./media:/media:ro
      - ./config:/config:ro

Keep credentials out of the file if it will be shared or checked into source control. Compose secrets are mounted as files inside services, but how those secret files are provisioned depends on the host and Compose implementation. Choose a protected runtime file or appropriate secret mechanism, and verify that the encoder can read it without exposing it in logs.

Docker’s production guidance discusses production overrides and restart policies; its Compose service reference documents service configuration. For a quickstart, see Docker Compose getting started.

Start, inspect, and update the service

  1. From the directory containing the Compose file, run docker compose up -d to start the stack in the background.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
    Rank #3
    Sale
    Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
    • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
    • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
    • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
    • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
    • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
  2. Run docker compose ps to check the service’s container status.

  3. Run docker compose logs -f streamer to follow the encoder service’s logs. Avoid logging the stream key or other credentials.

  4. After changing Compose configuration or environment values, recreate or update the service as needed. docker compose restart only restarts existing containers; it does not apply changed Compose configuration or environment values. See Docker’s restart command reference.

4. Protect the server and stream key

Review the Hetzner Cloud firewall rules before deployment. Hetzner’s Cloud API documentation states that a firewall with no inbound rules drops inbound traffic. Permit only the administration access you need, and restrict SSH to trusted sources where possible.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

The encoder ordinarily makes an outbound connection to YouTube, so do not open an inbound streaming port unless your chosen architecture specifically requires a listener. Keep the YouTube key out of source control and rotate it if it is exposed.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

5. Configure and validate the stream

Set the encoder to send a format YouTube accepts. YouTube recommends RTMPS for secure ingestion. Its guidance on streaming bitrates and encoding settings recommends leaving 20% upload headroom above the total stream bitrate; account for both primary and backup bitrate where applicable. For an incorrect-format error, YouTube identifies H.264 video and AAC audio in its troubleshooting guidance.

  1. Start with a test stream and inspect the preview in YouTube Live Control Room before relying on the setup.

  2. Test with movement and audio similar to the actual content. Check the stream health indicator and verify the video and sound.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
    Best Value
    Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
    • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
    • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
    • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
    • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
    • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
  3. Confirm playback from the public watch page and on a mobile device.

  4. Monitor both the container and the stream’s reception. YouTube’s live-streaming tips cover stream health and testing.

A healthy container status only says something about the container, not whether its output is reaching YouTube correctly. A restart policy may help after a process stops, but it cannot necessarily identify a frozen source, bad key, ingest failure, or unusable output from a process that remains alive. Add monitoring appropriate to your encoder and test the recovery path. If you require continuity through an encoder or host failure, use a genuinely independent backup path and test failover; YouTube recommends exercising backup-encoder failover in its streaming tips.

6. Plan for very long streams

YouTube states that streams under 12 hours are automatically archived. The cited guidance does not establish that one live event can run indefinitely or specify what happens when a stream exceeds 12 hours. If you need a very long broadcast, plan a restart or segmentation approach and confirm YouTube’s current behavior before depending on it. See YouTube’s live-stream archiving guidance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshooting common failures

Symptom Likely area to check What to do
Compose reports that the service is stopped or repeatedly restarting. Container command, image, configuration, or source mount. Inspect docker compose ps and docker compose logs -f streamer. Verify the image tag, command, mounted paths, file permissions, and that the source exists.
The container is running, but YouTube does not show a healthy preview. Encoder output, stream URL or key, source playback, or ingest connectivity. Check the encoder logs without exposing credentials, verify the URL and key in YouTube Studio, and inspect Live Control Room’s preview and health indicator. Do not assume a running container means a healthy stream.
YouTube reports an incorrect or unsupported format. Video or audio codec and encoder output settings. Check the encoder’s output format; YouTube identifies H.264 video and AAC audio for this error in its format troubleshooting guidance.
The stream is unstable or drops frames. Upload capacity, bitrate, host load, or network path. Check total bitrate and leave the 20% upload headroom YouTube recommends. Test at the actual resolution, frame rate, and content complexity; inspect server and encoder load rather than assuming a universal instance size.
Changes to the Compose file appear to have no effect. Restarting an existing container instead of applying updated configuration. Use an appropriate Compose update or recreation operation. Docker documents that docker compose restart does not apply changed configuration or environment values.
The stream key may have been exposed. Credential in a repository, shared file, or logs. Reset the key in YouTube Live Control Room, update the protected runtime configuration, and restart or recreate the service as needed.

Or let it run in the cloud

If you want a managed route instead of maintaining a Hetzner server and encoder, StreamNeo keeps an uploaded video or playlist live on YouTube from the cloud:

  1. Upload a recording or build a playlist.

  2. Add your YouTube stream key once.

  3. Go live; StreamNeo loops the content from its cloud service, so your computer and home connection do not have to stay on.

There is no home machine that has to remain on; uploaded video streams as made, up to 4K 60fps, at one price per slot. StreamNeo automatically recovers if YouTube drops the stream. The first day is free with no card required. Monthly pricing is $9.99 per month.

Start your free StreamNeo day.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from Patch Notes

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.