-
Notifications
You must be signed in to change notification settings - Fork 37
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
Docker - store config.json outside docker #34
Comments
Hi, thanks for reporting this issue. I think should clarify some concepts of docker before we jump to conclusions. Having all files of a container isolated inside itself (by default) is one of the goals and big advantages of docker. So it is not (and should not be possible) to access host files from inside a container. If you need to persist application data over the lifetime of a container it is always the other way round: The host mounts files/folder inside the container at defined mount points without the container knowing about it. "Typical" paths like /config don't exist here because the host and/or container could be a windows system... For a general overview of the storage concepts of docker you could have a look at https://docs.docker.com/storage/. The described behaviour of an updated Dockerfile overwriting existing configurations is not true either. Please have a look at https://docs.docker.com/get-started/#images-and-containers for the basic concepts of images and containers. Any change to the Dockerfile will create a new images. If you create new containers from this new image a new configuration will be created inside the new container. Any old container will remain unchanged without loosing it's configuration. In addition to this Kelvin will update itself inside running containers to benefit from recent improvements. If you want to persist one configuration over the lifetime of different containers (and potentially different images) you could have a look at #32 to learn about current limitations of Kelvin and suggestions to work around them. Hope this helps!?! |
Thanks for the rapid response! Allthough I’m in no way a Docker expert, I think I understand all that. However, just about every Docker I run uses a volume mapping to store its data, including its configuration files, on the host system so that the data persists and can be backed up. The problem here is that there is no path within the Kelvin docker that we can map to. The config file is stored in the Kelvin directory itself. What I meant by /config is that it is common to store such files in a /config folder within the container and then allowing the user, through the -v run command, to map that folder to wherever they want. This is typically done using an ln hard link in the Dockerfile. We also can’t add those mappings in the container as you are distributing an image, not a Dockerfile. What I’m requesting is that config.json is stored in a mappable folder rather than the root. I’d also perhaps request that the Docker be distributed as a Dockerfile as well as an image so that we build our own image for updates, but that’s not really necessary. As I said, I’m not a Docker expert so I may already be able to do this with the current image, my apologies if that’s so. However I don’t want to spend time tweaking a config file only to have it disappear. Docker containers are designed to be ephemeral and not for storing editable data. Not complaining by the way! To avoid this problem I’m currently running Kelvin in a Ubuntu VM, but I’d rather run it as a Docker. |
No need to apologize! I got your question wrong. Didn't mean to be offensive! I just released Kelvin v1.1.6 which allows custom path for the configuration outside the current working directory. As mentioned in #32 this was a limitation until now. Your should now be able to mount the /etc/opt/kelvin folder on your host system and keep your configuration over the lifetime of your container. Let me know if this works for you! |
Thanks! :-) |
That worked perfectly, thank you! I added the mapping to a folder on my server (I run Unraid) and mapped port 8080 in the container to 8084. My Docker run command looks like this:
Worked first time and everything looks good. The config.json is now back in the server on a regular disk and gets backed up. |
Perfect! Glad it worked. |
Hi,
I'd like to run Kelvin in a Docker under Unraid, however it looks like the config.json file is stored inside the docker, which means it will get overwritten whenever the docker file is updated?
If I'm right in this conclusion, please look at mapping a path for storing the config.json application data outside of the container itself on the host machine. Typically this would be at the /config location
Thanks!
The text was updated successfully, but these errors were encountered: