You can run playlist playback in a Docker container and have Docker restart the container after its process exits—but Docker will not restart a GStreamer pipeline that errors while the process stays alive. A reliable setup therefore needs three parts: playlist orchestration, GStreamer playback, and an explicit recovery policy. The examples below explain the design without presenting an untested one-command pipeline as a working solution.
How the pieces fit together
Treat playlist playback and container recovery as separate jobs. A playlist manager chooses what to play next; GStreamer plays a media URI; Docker acts only when the container process exits. GStreamer’s playbin supports URI playback and reports events such as errors and end of stream, but it is not by itself a managed playlist service. (GStreamer documentation, “playbin”; Docker documentation, “docker container run.”)
As an Amazon Associate I earn from qualifying purchases.
- Playlist layer: enumerate entries and decide their order, using yt-dlp or application code.
- Playback layer: give GStreamer an absolute, resolvable media URI through
playbinor an application built with the GStreamer API. - Recovery layer: let the application respond to playback events; use Docker’s restart policy for process exits.
For each failed playlist entry, decide whether the application should retry it, skip to the next entry, or exit so Docker can restart the process. Make the same decision for end-of-stream: advance to the next entry, loop the playlist, or finish and exit. Without application logic for those events, Docker cannot provide playlist progression.
Choose a playback approach
Use gst-launch-1.0 to explore a pipeline
gst-launch-1.0 is useful for debugging and trying out a pipeline. GStreamer’s documentation says it is “primarily a debugging tool” and advises: “You should not build applications on top of it.” A command-line launch can help you investigate playback, but it does not supply the playlist management and error-handling behavior a durable service needs. (GStreamer documentation, “gst-launch-1.0.”)
#1 Best Overall
- Includes Raspberry Pi 5 with 2.4Ghz 64-bit quad-core CPU (8GB RAM)
- Includes 128GB Micro SD Card pre-loaded with 64-bit Raspberry Pi OS, USB MicroSD Card Reader
- CanaKit Turbine Black Case for the Raspberry Pi 5
- CanaKit Low Noise Bearing System Fan
- Mega Heat Sink - Black Anodized
Build a small application for ongoing playback
For an application, use GStreamer’s API and listen for messages on the pipeline bus. In particular, handle errors and end-of-stream: the application can log what happened, decide whether to retry or advance, and set up playback for the next URI. That application—not Docker—owns transitions between playlist items and recovery while its process remains alive. (GStreamer documentation, “playbin.”)
Make playlist extraction and sequencing explicit
yt-dlp documents playlist extraction, with full playlist extraction as the default. Its --flat-playlist option avoids extracting entry details; depending on the workflow, that can mean the details needed to resolve media for playback are not available from the playlist listing alone. Choose the extraction mode based on what your application needs for each entry. (yt-dlp README.)
Rank #2
- Includes Raspberry Pi 5 16GB with 2.4Ghz 64-bit quad-core CPU (16GB RAM)
- Includes 128GB Micro SD Card pre-loaded with 64-bit Raspberry Pi OS, USB MicroSD Card Reader
- CanaKit Turbine Black Case for the Raspberry Pi 5
- CanaKit Low Noise Bearing System Fan
- Mega Heat Sink - Black Anodized
yt-dlp also documents sending media to standard output with -o - and shows piping output to VLC in its FAQ. That establishes a general player-pipe pattern, not a tested GStreamer command or a complete playlist player. Do not assume that piping an entire playlist into gst-launch-1.0 playbin will sequence entries correctly. Your wrapper or application must obtain a playable URI or media input for an entry, manage the transition, and define its failure behavior. (yt-dlp FAQ; yt-dlp README.)
- Enumerate the playlist. Use yt-dlp or application code to get entries in the desired order. Decide whether unavailable entries should be skipped or stop playback.
- Resolve one entry for playback. Obtain a media URI or input that GStreamer can use. yt-dlp’s available formats and extraction behavior can change, so check the current yt-dlp version and format-selection behavior when implementing.
- Start GStreamer playback. Set the URI on
playbinand monitor the pipeline bus for errors and end-of-stream. - Apply the playlist policy. On end-of-stream, advance or loop as intended. On error, retry, skip, or exit according to a deliberate policy; log the entry and event so failures can be diagnosed.
- Keep the application observable. Log the current entry, transitions, errors, and exits. A container restart alone does not tell you which playlist item failed or why.
Choose a Docker restart policy by the behavior you want
Docker’s documentation summarizes the scope: “A restart policy controls whether the Docker daemon restarts a container after exit.” The policy acts after the container process exits; it does not repair an individual pipeline inside a still-running application. (Docker documentation, “docker container run.”)
Rank #3
- CanaKit Raspberry Pi 5 Essentials Starter Kit
| Policy | When it restarts | Manual-stop and daemon behavior |
|---|---|---|
no |
Does not automatically restart the container; this is the default. | No automatic restart behavior is configured. |
on-failure[:max-retries] |
Restarts after a non-zero process exit; an optional retry limit can cap attempts. | Does not restart merely because the Docker daemon restarts. |
always |
Restarts after exit. | Has special handling after a manual stop; consult Docker’s current policy documentation for the precise behavior you need. |
unless-stopped |
Restarts after exit. | Preserves a manual stop across daemon restarts. |
Use on-failure if the process should be restarted only after an unsuccessful exit. Choose always if you want it brought back after exits and do not need a manual stop to persist across daemon restarts. Choose unless-stopped if an intentional manual stop should remain in effect after a daemon restart. Check Docker’s documentation for your installed version before relying on edge-case behavior.
Example with docker run
For a container whose application should be restarted after a non-zero exit, a configuration example is:
Rank #4
- All-in-One Complete Kit: This SANOOV RPi 5 bundle comes with Raspberry Pi 5 4GB RAM single board, active cooler, durable ABS case and screwdriver. No extra parts needed, ready to use right out of the box for beginners and hobbyists
- Powerful Single Board Computer: Equipped with 4GB RAM and high-performance processor, delivers fast running speed for 4K playback, AI projects, programming and daily computing tasks. SANOOV for raspberry pi 5 4GB is equipped with broadcom 64 quad-core Arm Cortex A76 processor with gigabit ethernet and upgraded with IEEE 802.11ac Wi-Fi, Bluetooth 5.0 dual-band 2.4Ghz and 5Ghz and Power Over Ethernet (POE). Upgrading delivers 2-3 x speed vs Pi 4, redefining the experience
- Efficient Active Cooler: Effectively lowers operating temperature and prevents performance throttling. Runs quietly even under long-time heavy load, ensures stable operation all day long. SANOOV RPi 5 4GB kit offer an active cooler, which combines an aluminium heatsink with a high-performance PWM fan. Active cooler is fully compatible with the Pi OS, which can effectively reduce the temperature of RPi5 and ensure its good performance during long-term high load operation
- Sturdy ABS Protective Case: Well-fitted for Raspberry Pi 5 board, can be secured with 4 screws to effectively protect the Pi 5 motherboard from damage, reserves full access to all ports and buttons. SANOOV uses ABS material to produce the case, which has a softer texture and feel. Meanwhile, SANOOV case adopts a layered design for easy disassembly and installation. (Tip: The Case cannot install M.2 HAT Add on Board and Solid State Drive!)
- Wide Application & Full Compatibility: Seamlessly compatible with official OS and mainstream peripheral accessories for Raspberry Pi 5. Whether you are a beginner, student, electronics hobbyist or professional developer, this all-in-one kit meets your diverse needs. It excels in IoT projects, robotics design, retro gaming devices, home media servers and other DIY creations. Backed by a large global community, you can easily find guides, technical support and shared projects online
docker run --restart on-failure:5 your-image
This illustrates Docker restart-policy syntax only. your-image is a placeholder for the image you build, and the example does not build the GStreamer application, extract a playlist, configure media inputs, or establish a YouTube broadcast. Choose the retry limit for your operational needs. If the application handles a playback error and stays alive, this policy will not restart it.
Recommended Free Tools
Keep YouTube streaming and media rights in scope
Playing a playlist through GStreamer is not by itself a complete YouTube live-stream setup. The workflow here addresses containerized playlist playback and process recovery; it does not supply YouTube broadcast configuration. Make sure your separate live-streaming setup is configured, and only stream material you have the rights and permission to use. The technical documentation described above does not establish permission to access, rebroadcast, or redistribute particular media, and you should follow the applicable source-service terms.
Best Value
- 【What you Get】You will get 1*Pi 5 8GB Single Board,1*RasTech Case,1*Active Cooler,1*Screwdriver,1*Installation instructions,12-month free warranty, lifetime service, 24-hour prompt and friendly response.
- 【More Connectors】There are two USB 3.0 ports(5Gbps simultaneously) and two USB 2.0 ports, which triple total bandwidth ,support any combination of up to two cameras or displays. Peak SD card performance is doubled through support for the SDR104 high-speed mode. It provides a smooth desktop experience for you. Offer Gigabit Ethernet and a PCIe interface, along with dual-band Wi-Fi and Bluetooth 5.0/BLE wireless capability. The RasTech Pi 5 Kit use the new 27W 5.1V 5A USB-C power connector.
- 【 Support Dual 4Kp60 Display 】Each of the two microHDMI sockets can control a 4K display at 60 Hertz, now support HDR, offering super HD video for media streaming projects. RPi 5 is the first RPi model that comes with a PCI Express port (PCIe 2.0 x1 with 500 MB/s) to attach SSDs (requires separate M.2 HAT).
- 【 Excellent Chips And Applications】Pi 5 is a full-size Pi computer using silicon built in-house at Pi. The RP1 “southbridge” provides the bulk of the I/O capabilities for Pi 5. Pi 5 is more friendly and convenient in the development of Internet of Things, Web development, machine identification, automatic control and other electronic equipment applications and network.
- 【 Faster CPU, Better GPU 】 Pi 5 features a Broadcom BCM2712 64-bit quad-core Arm Cortex-A76 processor running at 2.4GHz, it delivers a 2–3× increase in CPU performance relative to RaspberryPi 4. The 800MHz VideoCore VII GPU is compatible to OpenGL ES 3.1 and Vulkan 1.2, substantial uplift in graphics performance. Pi 5 Offers lightning-fast CPU speed, a PCI Express interface, a Real Time Clock (RTC) and a power button and runs significantly cooler than Pi 4.
Troubleshoot by identifying which layer failed
- The container exited and stayed down: check the configured restart policy and the process exit status. The default
nopolicy does not restart it;on-failurerequires a non-zero exit. - Playback failed but the container is still running: Docker has no process exit to react to. Inspect GStreamer bus errors and implement an application-level retry, skip, or exit decision.
- The first playlist item plays but later items do not: check whether the application handles end-of-stream and explicitly resolves and starts the next entry.
playbindoes not turn a playlist URL into a managed playlist service. - An item cannot be resolved or played: check the extracted entry and its playable URI or input, then verify current yt-dlp extraction and format-selection behavior. Those behaviors and available formats can change.
- A manually stopped container returns after a daemon restart: review whether you chose
alwaysorunless-stopped; the latter is intended to preserve a manual stop across daemon restarts.
Or let it run in the cloud
If your goal is simply to keep uploaded videos playing as a YouTube live stream, StreamNeo is a separate hosted option rather than a Docker/GStreamer deployment. Upload a recording or build a playlist, add your YouTube stream key, and go live. Nothing has to stay on at home; it plays uploaded videos, not a camera feed. It streams the upload as made, up to 4K 60fps, at one price per slot, with automatic recovery if YouTube drops the stream. The first day is free with no card. Monthly: $9.99 per month. See StreamNeo or plan details, then start your free first day.
Quick Recap
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.




