Pianobar configuration in docker

In order to get something ‘into’ docker it has to go into the image - you can’t put something in at ‘runtime’ because that is totally transient. If you imagine Docker is as if you have to ‘compile’ the OS build, putting all files and packages into the image, then you can simply execute whatever is already there - maybe not the clearest analogy, but let me try to explain.

You use a Dockerfile to add things into the image, so they are available when you run the container. The previously linked example used apk to add a package. Here are some examples using COPY to get files into an image, and that’s one technique you can use for config files like for your pianobar, see more examples here

There is an alternative to creating your pianobar config in the folder and using the Dockerfile to COPY it in – to RUN the echo command and create the file from a heredoc, such as the example here.

In any case you need to get the file into the docker image before you run it, that is the way that docker works. And I do hope that you are using a docker-compose.yaml file to run your image, because that puts everything into a nice clear editable, version-controllable file.

Good luck!

1 Like