shairport-sync-docker icon indicating copy to clipboard operation
shairport-sync-docker copied to clipboard

Not able to mirror an external copy of shairport-sync.conf in to /etc/shairport-sync.conf

Open marioscube opened this issue 1 year ago • 7 comments
trafficstars

I installed shairport-sync-docker on debian 12 bookworm like this:

docker run -d --name=shairport-sync --net host --device /dev/snd -v /home/user/Docker/shairport-sync/config.conf:/etc/shairport-sync.conf mikebrady/shairport-sync:development -a Shairport -- -d hw:0 -c PCM but I am not seeing config.conf in the expected directory.

What am I doing wrong?

shairport-sync-docker works (with owntone) but I cannot easily adjust settings.

marioscube avatar Aug 23 '24 21:08 marioscube

Apologies for not seeing this. Did you ever get it working? (I wonder if it is/was a permissions problem...)

mikebrady avatar Jan 01 '25 15:01 mikebrady

No problem.

I never got it to work with a config file. Tried again today.

docker run -d \
--name=shairport-sync-test \
--net host \
--device /dev/snd \
-v /home/user/Docker/shairport-sync/config/shairport-sync.conf:/etc/shairport-sync.conf \
mikebrady/shairport-sync:development-classic \
-v --statistics -a PC -- -d hw:0 -c PCM

does not show a shairport-sync.conf file

Neither does

docker run -d \
--name=shairport-sync-test \
--net host \
--device /dev/snd \
-v /home/user/Docker/shairport-sync/config:/etc \
mikebrady/shairport-sync:development-classic \
-v --statistics -a PC -- -d hw:0 -c PCM

I created /home/user/Docker/shairport-sync/config and did chmod 777 /home/user/Docker/config so probably no permission problems here.

I probably do something wrong somewhere, but .......

Any help is appreciated.

marioscube avatar Jan 02 '25 13:01 marioscube

Just edited your comment for format — I hope it okay.

mikebrady avatar Jan 02 '25 13:01 mikebrady

Am I right in thinking you’d have done chmod 777 /home/user/Docker/shairpprt-sync/config/shairport-sync.conf in the first case and chmod 777 /home/user/Docker/shairpprt-sync/config in the second case? That is slightly different to what you report above.

Anyway, I was going to ask what error message you get from Docker when it can’t find the mirrored file?

mikebrady avatar Jan 02 '25 13:01 mikebrady

Hey, it's your github, edit whatever you like ;-)

I did chmod 777 /home/user/Docker/shairport-sync/config There is no shairport-sync.conf file.

To recapitulate:

If I start shairport-sync with:

docker run -d \
--name=shairport-sync-test \
--net host \
--device /dev/snd \
-v /home/user/Docker/shairport-sync/config/shairport-sync.conf:/etc/shairport-sync.conf \
mikebrady/shairport-sync:development-classic \
-v --statistics -a PC -- -d hw:0 -c PCM

I get an error:

docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/home/debian/Docker/shairport-sync/config/shairport-sync.conf" to rootfs at "/etc/shairport-sync.conf": create mountpoint for /etc/shairport-sync.conf mount: cannot create subdirectories in "/var/lib/docker/overlay2/a48b4ad93647e0f870b5608c1db06efa67c640a60ae86cf3b739cc95db3d5cfe/merged/etc/shairport-sync.conf": not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type.

If I start shairport-sync with:

docker run -d \
--name=shairport-sync-test \
--net host \
--device /dev/snd \
-v /home/user/Docker/shairport-sync/config:/etc \
mikebrady/shairport-sync:development-classic \
-v --statistics -a PC -- -d hw:0 -c PCM 

It works, but there are no files in /home/user/shairport-sync/config except:

~/Docker/shairport-sync/config$ ls -l
total 0
-rw-r--r-- 1 root root 0 Jan  2 15:15 hostname
-rw-r--r-- 1 root root 0 Jan  2 15:15 hosts
-rw-r--r-- 1 root root 0 Jan  2 15:15 resolv.conf

/home/Docker/shairport-sync/config is 777.

Docker can find /etc/shairport-sync.conf just fine inside the container.

marioscube avatar Jan 02 '25 14:01 marioscube

Thanks for the update. It's still a bit confusing. It seems that we're slightly at cross purposes -- maybe that indicates that we are getting close to the issue...

You need to have the file shairport-sync.conf actually already in the /home/user/Docker/shairport-sync/config directory. In other words, it must already exist -- Docker isn't going to create one, nor will it "mirror" or copy the shairport-sync.conf file that it has in its own /etcdirectory.

The fact that it doesn't complain about this mapping:

-v /home/user/Docker/shairport-sync/config:/etc 

and that /home/user/Docker/shairport-sync/config ends up with those files in it shows that it works, and the Docker image was treating /home/user/Docker/shairport-sync/config as its own /etc directory, as per the mapping.

So let me suggest that you create a shairport-sync.conf file and place it in /home/user/Docker/shairport-sync/config and try this again:

docker run -d \
--name=shairport-sync-test \
--net host \
--device /dev/snd \
-v /home/user/Docker/shairport-sync/config/shairport-sync.conf:/etc/shairport-sync.conf \
mikebrady/shairport-sync:development-classic \
-v --statistics -a PC -- -d hw:0 -c PCM

In this case, the /home/user/Docker/shairport-sync/config/shairport-sync.conf file will be mapped into the Docker image's /etc directory.

mikebrady avatar Jan 03 '25 15:01 mikebrady

Aha! Not what I expected with my limited experience with other docker containers.

UPDATE:

That seems to work! Thank you.

marioscube avatar Jan 03 '25 15:01 marioscube