Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
marioscube opened this issue Aug 23, 2024 · 7 comments

Comments

@marioscube
Copy link

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.

@mikebrady
Copy link
Owner

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

@marioscube
Copy link
Author

marioscube commented Jan 2, 2025

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.

@mikebrady
Copy link
Owner

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

@mikebrady
Copy link
Owner

mikebrady commented Jan 2, 2025

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?

@marioscube
Copy link
Author

marioscube commented Jan 2, 2025

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.

@mikebrady
Copy link
Owner

mikebrady commented Jan 3, 2025

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.

@marioscube
Copy link
Author

marioscube commented Jan 3, 2025

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

UPDATE:

That seems to work! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants