A simple and lightweight Docker image based on Alpine Linux to stream AirPlay to Sonos effortlessly. Based on @philippe44's fantastic work.
docker run -d --net=host tratosca/docker-airconnectRemove -d to run in foreground (not recommended)
--net=host is required to run in true bridged mode (allowing the container to be in the same IP subnet than the Docker host, your Sonos system and your AirPlay sender; at least on most configurations)
You can pass some facultative environment variables to this app:
-
CODEC=mp3:bitrate|flc:quality|wav(flc is for FLAC).bitratemust be specified if using MP3). Default:flc -
METADATA=1|0either if you wish to broadcast songs metadata to Sonos (1) or not (0). Default:1 -
LATENCY=integer:integerin the format ofnumber:numberwhere the firs is the AirPlay latency and the second is the Sonos latency. Increase value of the first one if your network is bad. The second is quite failsafe actually. Default500:500) -
ARTWORK=1|0either if you wish to broadcast the artwork pic to Sonos (1) or not (0). Default:1 -
NAME=your_fantastic_desired_namefor customizing the name of the AirPlay device. Only works if you build the image with your own conf file in/etcthat already contains a single Sonos device. Default:Sonos+. -
$MAXVOLUME=1..100for editing the max volume of the Sonos device that can be set from your AirPlay sender device. Default:100
git clone https://github.com/ItsPops/docker-airconnect.git
cd docker-airconnect
docker build . --tag yourself/airconnectCreate a docker-compose.yml file with this sample config:
services:
airconnect:
network_mode: "host"
container_name: airconnect
image: tratosca/docker-airconnect
environment:
- CODEC='wav'Run it, daemonized:
docker-compose up -d- Run the container once to let it detect your devices
docker run -d --net=host tratosca/docker-airconnect- Open a shell to the container
docker exec -ti airconnect sh- Generate a sample conf file that will override the default one
airupnp -i /etc/airupnp.confAfter a few seconds press Ctrl+C to exit and return to the container shell.
- Edit the conf file with
vi
vi /etc/airupnp.conf- Locate the
nameparameter and edit the value with the name you want :)
- Follow the guide below from step 1. to step 4. and add an env variable as
NAME=your_device_namein yourdocker-compose.ymlfile or in the command.
☐ Multi platform Docker image building (current image not tested on x86_64)
☐ Adding AirCast to allow streaming to Chromecast
☐ Adding more env variables to edit things
☐ Building from latest AirConnect sources instead of precompiled binaries
@1activegeek for his multiplatform build technique
@miegl for his env variable passing shell script
@philippe44 most importantly for Airconnect !
@kefranabg for this readme-md-generator