# π΅ PyBeats β Dockerized Python MP3 Player
PyBeats is a simple desktop MP3 player built using Python.
It uses **Tkinter** for the GUI and **Pygame (SDL2)** for audio playback.
This project is fully containerized and available on **Docker Hub**.
---
## π Features
- π΅ Play MP3 files
- π Load folders recursively
- π Shuffle mode
- β― Play / Pause / Stop
- π Seek bar (track progress)
- π Volume control
- π· ID3 metadata support (Title, Artist, Album)
- π³ Fully Dockerized
---
## π§° Tech Stack
### Standard Library
- `tkinter`
- `threading`
- `os`
- `pathlib`
- `random`
- `time`
### Third-Party Libraries
- `pygame` β Audio engine (SDL2 backend)
- `mutagen` β Reads MP3 metadata (ID3 tags)
Install locally:
```bash
pip install pygame mutagenThe official Docker image is available on Docker Hub:
π https://hub.docker.com/r/tejalonkar15/pybeats
Pull image:
docker pull tejalonkar15/pybeats:4.0This is a GUI desktop application.
Docker containers do NOT automatically support:
- GUI display
- Sound hardware access
You must enable:
- X11 forwarding
- ALSA audio device access
xhost +local:dockerdocker run \
--device /dev/snd \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
tejalonkar15/pybeats:4.0xhost -local:dockerIf you see this error:
pygame.error: ALSA: Couldn't open audio device
It means the container cannot access your sound hardware.
Make sure:
- You are on Linux
/dev/sndexists- Docker has permission to access audio devices
If you see:
_tkinter.TclError: no display name and no $DISPLAY environment variable
It means X11 forwarding is not configured properly.
Make sure:
xhost +local:dockerAnd that $DISPLAY is set:
echo $DISPLAYBase Image:
python:3.12-slim
Includes:
- SDL2 development libraries
- Tkinter system libraries
- Audio dependencies
- Python build tools
Optimized using:
--no-cache-dir
rm -rf /var/lib/apt/lists/*
Tkinter GUI
β
Pygame (SDL2 Mixer)
β
ALSA / Host Audio Device
Container Runtime:
Docker β X11 Socket β Linux Display Server
Docker β /dev/snd β Host Audio
This project demonstrates:
- Python GUI development
- Audio playback with SDL2
- Docker containerization
- Handling GUI apps inside Docker
- ALSA device mapping
- X11 forwarding
- Image tagging and publishing to Docker Hub
xhost +local:docker temporarily allows Docker containers to access your display.
Always disable after use:
xhost -local:dockerTejal Onkar Docker Hub: https://hub.docker.com/u/tejalonkar15
- Reduce image size
- Add playlist saving
- Add dark theme
- Multi-stage Docker build
- Web-based version