Docker Community Forums

Share and learn in the Docker community.

Overwriting data in container


(Irot) #1

Hi! Is it possible to change files in container and then save it without changing its ID?


(Sabin Basyal) #2

When you change files in the container, it will eventually change the ID when you perform commit to that container.


(Etki) #3

You shouldn’t rely on image ID of constantly evolving application. You can probably do what you want using image tag, because you can easily tag image during the build, thus substituting your previous reference to somerepo:latest.


(Irot) #4

The thing was that previous hostname - which was container ID, was added in some files (responsible for Internet connection) and a subscription key so there was no way to replace it - subscription would expire. I’ve managed with that problem. I’ve added a piece of code to my app’s launching script, that adds old container ID to /etc/hosts with the IP address which is assigned to current hostname (current container ID).

But in general it is a problem with apps that rely on hostname.