Link existing docker to external configuration file and data to be used it in C# core (linux container) Link existing docker to external configuration file and data to be used it in C# core (linux container) docker docker

Link existing docker to external configuration file and data to be used it in C# core (linux container)


It is extremely normal to need to delete and recreate containers. For instance, if you have a new build of your application, you’ll need to delete and recreate any containers that are running it to run against the new image. You can’t add a volume mapping to an existing container; but recreating containers should be so routine that it shouldn’t be a big deal to recreate it with the new volume mapping.

Using docker run -v as a path to inject config files into a container is pretty normal. You can store it at a fixed path in the container, and use whatever config-file-parsing library you have readily available to read it. It can be anywhere on the host, but it’s fine to have a fixed value for the right-hand side of the docker run -v option.

(The two other good things to use bind-mounted volumes for are getting log files out of a container, and storage of persistent data that lives in the filesystem but must outlive a single container instance.)