How do I change the ip to which a docker container is linked?

1

Create a docker container with a database on a computer with the IP (host) 10.1.1.100, the container has a web application, so port 80 of the container is routed to port 80 of the ip.

docker run --name contenedor -d -p 10.1.1.100:80:80 something/something

Everything worked correctly until there was a need to change the IP of the host. When I change the IP (to 10.1.1.200) and start the container docker start contenedor I get an error:

  

Error response from daemon: driver failed programming external   conectivity on endpoint ...: Error starting userland proxy: listen tcp   10.1.1.100:80: bind: can not assign requested address.
  Error: failed to start containers: container

What should be done to lift this container? I do not want to generate it again from scratch because it already has a lot of information in its database. Docker Version 1.13.1 CentOS 7 64bits

Thank you in advance.

    
asked by Hector Tapia 08.03.2017 в 19:43
source

1 answer

0

Once a container with some parameters has been created, it can no longer be modified. You could export the container ("docker save") and raise it again as a different one ("docker load") with other parameters.

Then, if it is a database, mount a volume with "docker volume" so that next time you can discard the container but keep the information from the database.

    
answered by 09.03.2017 / 09:37
source