My IP got changed after Docker installation :(

My previous ip was 192.168.1.3 and it got changed to 192.168.1.8. I wonder why

It this a problem?

Unless somehow fixed, IP are usually dynamic (in general, not only for Docker)

yes it is a problem. Because I did a fixed IP for the machine with x.x.x.3

How many device on your machine are requiring IPs? Devices get different IPs all the time, that’s pretty normal behavior.

When you start a Docker machine, there’s a line that warns you about the fact that the IP might have changed: Started machines may have new IP addresses. You may need to re-run the docker-machine env command.

$ docker-machine start
Starting "default"...
(default) Check network to re-create if needed...
(default) Waiting for an IP...
Machine "default" was started.
Waiting for SSH to be available...
Detecting the provisioner...
Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command.

$ docker-machine env
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.100:2376"
export DOCKER_CERT_PATH="/Users/alexandre.leveille/.docker/machine/machines/default"
export DOCKER_MACHINE_NAME="default"
# Run this command to configure your shell:
# eval $(docker-machine env)

You can have a look at the below thread on how to (kind-of) work around this:

docker-machine command is valid only on windows not Unix and Mac? Also don’t you think that if you are in Prod environment and you had machines with static ip and you supposedly install docker on each machine and its IP has changed?

Isn’t that a risker?

I have total 4VM’s and all of them had a static IP, I installed docker on one of them and its IP changed :worried:

Can you elaborate on your setup a little? I’m not sure I follow.

docker-machine is available on Linux, Mac and Windows (must install the Toolbox for Mac and Windows)

In production, the machine(s) should be remote host(s) that run 24/7. You would use docker-machine to connect to these hosts with static IPs.

In development, the machine is hosted on your localhost (perhaps through VirtualBox) and may get a different IP each time.

Does this help?
Alexandre

Well I have a static IP from my ISP provider. Secondly I did set static ip by writing it to hosts file and it was same until docker engine got installed. Can it happen that IP is changed because of docker-engine installation.

I have 4 virtual machines on my host(Windows 10). I have a router. and Virtualization Software is Virtual box.

Each of the machine has a fixed IP and It was working perfectly fine until I installed docker-engine.

What makes me wonder is why my IP changed.

Steps taken to set fix IP is as follows:
In Virtual machine settings for all four VM’s, Network 1 is bridged and Network 2 is Host-only. I read that is way you set static IP to your virtual machine.

Does the above step NOT set to static IP?

Previously I could do ssh between the machines which I cannot do now.

All mess just with docker engine installation or is some where my knowledge is failing or is not sufficient.

I really need to get my lab with static ip as it affects my study.

root@jim-Ubuntu1504:~# docker-machine start
Error: No machine name(s) specified and no “default” machine exists.
root@jim-Ubuntu1504:~# docker-machine env
Error: No machine name(s) specified and no “default” machine exists.

Where it says docker-machine for Unix ?

Docker machine on linux, installation: https://docs.docker.com/machine/install-machine/

at first: I started with VMs (virtualbox), docker-swarm & docker-machine just few hours ago (but I am not in a hurry, and I do simply read the info/error-messages & suggestions…)

1.) if you restart the System/VMs, the IPs of the VMs simply seem to count up in the chronological order (so: IP might be different from last time (and this has nothing to do with your IP from your Internet Service Provider))
2.) you can list the machines available and get their names with:

docker-machine ls

3.) there is a SSH used for a secure connection - and the x509: certificate is assigned with the names - and valid for the IPs during their creation.
4.) If this change of IP did happen, you are receiving the info “Started machines may have new IP addresses. You may need to re-run the docker-machine env command.”
so: simply add the name of your VM (from docker-machine ls) to the command & check if it is so with:

docker-machine env yourVMname

results eg in:

Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host “192.168.99.100:2376”: x509: certificate is valid for 192.168.99.101, not 192.168.99.100
You can attempt to regenerate them using ‘docker-machine regenerate-certs [name]’.
Be advised that this will trigger a Docker daemon restart which might stop running containers.

docker-machine regenerate-certs yourVMname

then start with restart (not: start):

docker-machine restart yourVMname

for the other machine:

docker-machine restart theOtherVMname
results in:

… Restarted machines may have new IP addresses. You may need to re-run the docker-machine env command.

so:
docker-machine env theOtherVMname

results in:

export DOCKER_TLS_VERIFY=“1”
export DOCKER_HOST=“tcp://192.168.99.101:2376”
export DOCKER_CERT_PATH=“/home/theusr/.docker/machine/machines/theOtherVMname”
export DOCKER_MACHINE_NAME=“theOtherVMname”
/# Run this command to configure your shell:
/# eval $(docker-machine env theOtherVMname)

so:
eval $(docker-machine env theOtherVMname)

check with:
docker-machine ls
→ should be up and running.