Overwritten File with docker cp command is reset when stop and start container.
OS: CentOS Stream release 9
Docker: Docker version 24.0.6 build ed223bc
Image: Cassandra:4.1.2
While configuring and using the cluster, the assigned IP address changed, so I used docker cp to change the settings of the container’s cassandra.yaml file, but the settings were reset again.
1.container run with “A-ip”. cluster dc1 run without any problem.
2.host mahcine reassign ip address to virtual machine as bridged ip.
3.sudo docker cp cassandra-container:/etc/cassandra/cassandra.yaml /home/user/Desktop/folder/cassandra.yaml
#copy cassandra configuration file from container to host
4.vim cassandra.yaml and change value of seeds, broadcast_address, broadcast_rpc_address to “B-ip”(which is present IP address of vm)
#change configuration value of file
-seeds=IP-B
-broadcast_address=IP-B
-broadcast_rpc_address=IP-B
5.sudo docker cp /home/user/Desktop/folder/cassandra.yaml cassandra-container:/etc/cassandra/cassandra.yaml
#overwrite cassandra configuration file from host to container
6.sudo docker cp cassandra-container:/etc/cassandra/cassandra.yaml /home/user/Desktop/folder/cassandra-check.yaml
#Checking overwritten is applied properly.
7.vim cassandra-check.yaml
#overwriting is applied correctly
8.stop container
9.start container
10.sudo docker cp cassandra-container:/etc/cassandra/cassandra.yaml /home/user/Desktop/folder/cassandra-check.yaml
#checking configuration file
11.The values I changed have been reset to initial values.
-seeds=IP-A
-broadcast_address=IP-A
-broadcast_rpc_address=IP-A
Even after repeating the process and searching through the community to see where the problem occurs, I cannot find the reason. I would really appreciate it if someone could tell me a solution.