Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DaveBben/pipewire-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PipeWire and ROC Docker Image

Minimal Debian-based Docker image that bundles PipeWire, WirePlumber, and ROC toolkit. Verified working for streaming and receiving audio over a network using UDP.

Quick Start

One line copy paste. Make sure to mount a folder pointing to your local pipewire config files.

docker run --rm -it \
  --device /dev/snd \
  -v "$(pwd)/pipewire.conf.d:/home/appuser/.config/pipewire/pipewire.conf.d" \
  -p 10001:10001/udp \
  -p 10002:10002/udp \
  -p 10003:10003/udp \
  -p 20001:20001/udp \
  -p 20002:20002/udp \
  -p 20003:20003/udp \
  -e AUTO_LINK_SOURCE=seed-microphone-mono \
  -e AUTO_LINK_TARGET=roc-sink \
  -e PUID=$(id -u) \
  -e PGID=$(id -g) \
  -e AUDIO_GID=$(getent group audio | cut -d: -f3) \
  pipewire-docker

The total startup can take around 15 seconds. During that time you should see the following logs:

Starting system D-Bus as root...
Setting permissions for user {PUID}...
Switching to user {PUID}:{PGID} to start PipeWire and application...
[entrypoint] PipeWire stack launched
[entrypoint] Waiting for WirePlumber graph to link seed-microphone-mono → roc-sink
[entrypoint] Linked seed-microphone-mono → roc-sink
[entrypoint] Handing off to CMD: bash

Auto-linking Devices (Optional)

You can automatically link audio devices using the AUTO_LINK_SOURCE and AUTO_LINK_TARGET environment variables:

-e AUTO_LINK_SOURCE=seed-microphone-mono
-e AUTO_LINK_TARGET=roc-sink

This will wait for PipeWire to finish initializing, then it will run:

pw-link seed-microphone-mono roc-sink

pw-top screenshot

Docker Compose

Here is an example docker-compose which will automatically link my Raspberry Pi ReSpeaker 2-Mic to my roc-sink

To get your ID's

# audio
getent group audio | cut -d: -f3
# user
id -u
# group
id -g

.env file

UID=1000
GID=1000
AUDIO_GID=29

docker-compose.yml

services:
  test:
    image: pipewire-docker
    container_name: debian-pipewire
    devices:
      - /dev/snd
    restart: unless-stopped
    volumes:
      - ./pipewire.conf.d:/home/appuser/.config/pipewire/pipewire.conf.d
      -  pipewire_socket:/run/pipewire
    environment:
      - AUTO_LINK_SOURCE=seed-microphone-mono
      - AUTO_LINK_TARGET=roc-sink
      - PUID=${UID}
      - PGID=${GID}
      - AUDIO_GID=${AUDIO_GID}
      - PIPEWIRE_RUNTIME_DIR=/run/pipewire
    ports:
      - "10001:10001/udp"
      - "10002:10002/udp"
      - "10003:10003/udp"
      - "20001:20001/udp"
      - "20002:20002/udp"
      - "20003:20003/udp"
    stdin_open: true
    tty: true

volumes:
  pipewire_socket:

Permissions and Entrypoint

The default entry scripts sets up a dbus-daemon and sets permissions before using gosu to switch to the non-root user.

Building Locally

docker build -t pipewire-docker .  

Credits:

About

pipewire-docker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published