A lightweight, production-ready Icecast2 streaming server. Perfect for audio streaming apps.
1.8K
A lightweight, production-ready Icecast2 streaming server built on Alpine Linux Docker image. Perfect for audio streaming, internet radio, and live broadcasting applications.
# Pull and run the container
docker run -d \
--name icecast2-server \
-p 8000:8000 \
-e ICECAST_SOURCE_PASSWORD=your_source_password \
-e ICECAST_ADMIN_PASSWORD=your_admin_password \
-v $(pwd)/logs:/var/log/icecast2 \
liuzhen932/app-icecast:latest
Access the admin interface at http://localhost:8000/admin/
| Service | URL | Username | Password |
|---|---|---|---|
| Admin Interface | http://localhost:8000/admin/ | admin | hackme |
| Audio Stream | http://localhost:8000/stream | source | hackme |
| Status Page | http://localhost:8000/ | - | - |
ā ļø Security Warning: Change default passwords in production environments!
.
āāā Dockerfile # Docker image definition
āāā docker-compose.yml # Docker Compose configuration
āāā icecast.xml # Icecast2 configuration template
āāā entrypoint.sh # Container startup script
āāā README.md # This file
| Variable | Description | Default Value |
|---|---|---|
ICECAST_SOURCE_PASSWORD | Password for source connections | hackme |
ICECAST_RELAY_PASSWORD | Password for relay connections | hackme |
ICECAST_ADMIN_PASSWORD | Admin interface password | hackme |
ICECAST_ADMIN_USER | Admin username | admin |
ICECAST_HOSTNAME | Server hostname | localhost |
ICECAST_LOCATION | Server location | Earth |
ICECAST_ADMIN_EMAIL | Admin email address | [email protected] |
ICECAST_MAX_CLIENTS | Maximum concurrent clients | 100 |
ICECAST_MAX_SOURCES | Maximum concurrent sources | 2 |
ICECAST_PORT | Server listening port | 8000 |
environment:
- ICECAST_SOURCE_PASSWORD=super_secret_source_password
- ICECAST_ADMIN_PASSWORD=super_secret_admin_password
- ICECAST_ADMIN_USER=myadmin
- ICECAST_HOSTNAME=myradio.example.com
- ICECAST_LOCATION=New York, USA
- [email protected]
- ICECAST_MAX_CLIENTS=500
- ICECAST_MAX_SOURCES=10
version: '3.8'
services:
icecast2:
build: .
container_name: icecast2-production
restart: unless-stopped
ports:
- "8000:8000"
environment:
- ICECAST_SOURCE_PASSWORD=${SOURCE_PASSWORD}
- ICECAST_ADMIN_PASSWORD=${ADMIN_PASSWORD}
- ICECAST_HOSTNAME=${HOSTNAME}
- ICECAST_LOCATION=${LOCATION}
- ICECAST_ADMIN_EMAIL=${ADMIN_EMAIL}
- ICECAST_MAX_CLIENTS=1000
- ICECAST_MAX_SOURCES=20
volumes:
- ./logs:/var/log/icecast2
- ./web:/usr/share/icecast2/web
networks:
- icecast-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/admin/stats.xml"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
networks:
icecast-network:
driver: bridge
# Source and admin passwords
SOURCE_PASSWORD=your_secure_source_password
ADMIN_PASSWORD=your_secure_admin_password
# Server information
HOSTNAME=radio.yourdomain.com
LOCATION=Your City, Your Country
[email protected]
# Stream MP3 file
ffmpeg -re -i input.mp3 \
-acodec libmp3lame -ab 128k -ac 2 \
-content_type audio/mpeg -f mp3 \
icecast://source:your_source_password@localhost:8000/stream
# Stream live microphone input
ffmpeg -f alsa -i default \
-acodec libmp3lame -ab 128k -ac 2 \
-content_type audio/mpeg -f mp3 \
icecast://source:your_source_password@localhost:8000/live
# Stream from internet radio
ffmpeg -i http://example.com/stream.mp3 \
-acodec copy -f mp3 \
icecast://source:your_source_password@localhost:8000/relay
/streamlocalhost:8000source and your password# Test stream availability
curl -I http://localhost:8000/stream
# Listen with VLC
vlc http://localhost:8000/stream
# Listen with mpv
mpv http://localhost:8000/stream
# Listen with ffplay
ffplay http://localhost:8000/stream
# Get server statistics
curl -u admin:your_admin_password \
http://localhost:8000/admin/stats.xml
# Get listener statistics
curl -u admin:your_admin_password \
http://localhost:8000/admin/listclients.xml
# Kill a source
curl -u admin:your_admin_password \
-X POST http://localhost:8000/admin/killsource.xml?mount=/stream
server {
listen 80;
server_name radio.yourdomain.com;
location / {
proxy_pass http://localhost:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
server {
listen 443 ssl http2;
server_name radio.yourdomain.com;
ssl_certificate /path/to/certificate.crt;
ssl_certificate_key /path/to/private.key;
location / {
proxy_pass http://localhost:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
# Check container logs
docker logs icecast2-server
# Check configuration
docker exec icecast2-server cat /etc/icecast2/icecast.xml
# Verify permissions
docker exec icecast2-server ls -la /var/log/icecast2
# Find process using port 8000
sudo lsof -i :8000
# Kill process if needed
sudo kill -9 <PID>
# Or use different port
docker run -p 8080:8000
# Test network connectivity
curl -I http://localhost:8000/
# Check firewall
sudo ufw status
# Verify source password
grep source-password /etc/icecast2/icecast.xml
# Check active connections
curl -u admin:password http://localhost:8000/admin/stats.xml
# Monitor resource usage
docker stats icecast2-server
# Check for runaway processes
docker exec icecast2-server top
# Run with debug logging
docker run -it --rm \
-e ICECAST_LOG_LEVEL=4 \
-p 8000:8000 \
# Check container health
docker inspect icecast2-server | grep -A 5 Health
# Manual health check
curl -f http://localhost:8000/admin/stats.xml
# Mount custom configuration
docker run -d \
-v $(pwd)/custom-icecast.xml:/etc/icecast2/icecast.xml:ro \
-p 8000:8000 \
<!-- Add to icecast.xml -->
<mount type="normal">
<mount-name>/jazz</mount-name>
<username>source</username>
<password>jazz_password</password>
<stream-name>Jazz Radio</stream-name>
<stream-description>24/7 Jazz Music</stream-description>
<genre>jazz</genre>
</mount>
<mount type="normal">
<mount-name>/rock</mount-name>
<username>source</username>
<password>rock_password</password>
<stream-name>Rock Radio</stream-name>
<stream-description>Classic Rock Hits</stream-description>
<genre>rock</genre>
</mount>
<!-- Add to icecast.xml -->
<relay>
<server>upstream.example.com</server>
<port>8000</port>
<mount>/upstream</mount>
<local-mount>/relay</local-mount>
<username>relay</username>
<password>relay_password</password>
<relay-shoutcast-metadata>1</relay-shoutcast-metadata>
</relay>
# Add monitoring container
docker run -d \
--name icecast-exporter \
--link icecast2-server:icecast \
-p 9150:9150 \
icecast-exporter:latest
# Monitor access logs
docker exec icecast2-server tail -f /var/log/icecast2/access.log
# Monitor error logs
docker exec icecast2-server tail -f /var/log/icecast2/error.log
# Count unique listeners
docker exec icecast2-server \
awk '{print $1}' /var/log/icecast2/access.log | sort | uniq -c
When reporting issues, please include:
This project is licensed under the GNU General Public License v3.0 License - see the LICENSEā file for details.
Made with ā¤ļø by liuzhen932ā
Content type
Image
Digest
sha256:7a8e7ad58ā¦
Size
9.9 MB
Last updated
5 months ago
docker pull liuzhen932/app-icecast