-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Description
I'd like to be able to make configuration changes to a container (running or stopped). Specifically, any setting that can be set when starting a container with docker run should be able to be changed after-the-fact easily.
Rationale:
When working with containers, it's inevitable that at one point you find yourself in a situation where you've spent an hour fiddling with a running container so that you can start using it (e.g. setting up a job system in a Jenkins container), only to realize that you forgot to make a certain configuration change way back when you ran the container using docker run. This tends to happen a lot with badly-documented images on the Index; if the image documentation doesn't tell me that I need to expose port 443 on my host system, I'm probably going to forget that.
In such cases, it would be great if I could make container configuration changes whilst the container is running, or after I've stopped the container manually.
Unfortunately, docker doesn't currently seem to support this. Since you can't re-run a stopped container with docker run, you would need to commit the container to an image and then re-run it.
Unfortunately, docker commit clears the container's configuration, so you need to explicitly set a startup configuration using the -run commandline argument, unless you don't mind manually specifying the entrypoint/cmd et cetera each time you run this new image with docker run (which I don't think is very user friendly). As a workaround, you can inspect the container, copy the Config, and paste the config into the -run parameter of docker commit, but this isn't really user-friendly either.