So I am running VMs on VirtualBox to try to get Docker to work in distributed mode. As per this tutorial (https://docs.docker.com/get-started/part4/#configure-a-docker-machine-shell-to-the-swarm-manager) , I set VM called "myvm1" to the be swarm manager with ssh myvm1 "docker swarm init --advertise-addr 10.0.2.15",
however, when I try to add workers to that swarm, I get an error:
Error response from daemon: rpc error: code = Unavailable desc =
all SubConns are in TransientFailure, latest connection error:
connection error: desc = "transport: Error while dialing dial tcp
10.0.2.15:2377: connect: connection refused"
exit status 1
where 10.0.2.15 is the IP of the manager VM I got from running VBoxManage guestproperty get myvm1 "/VirtualBox/GuestInfo/Net/0/V4/IP"
Anyone know what could be the cause? Is my IP wrong? Do I need to open ports?
FYI: To add attempt adding a worker, I tired:
docker-machine ssh myvm2 "docker swarm join --token [token returned by swarm init on myvm1] 10.0.2.15:2377"
Not sure what else I can do.
This is probably because you are running Virtual Box. This mean that some of your interfaces are shared with other VMs and the host.
If you run ifconfig on your VMs and host, Choose the interface which exhibit different IPs for every machine VM.
I had this problem, too and figured out that the eth0 IPs were the same on every machine. Of course, this cannot work.
eth1 also had different IPs for every machine.
Hope this helps.
Related
After connecting to VPN I am facing issue with docker-machine create on windows 7. This is the error coming:
This machine has been allocated an IP address, but Docker Machine could not
reach it successfully.
SSH for the machine should still work, but connecting to exposed ports, such as
the Docker daemon port (usually :2376), may not work properly.
You may need to add the route manually, or use another related workaround.
This could be due to a VPN, proxy, or host file configuration issue.
You also might want to clear any VirtualBox host only interfaces you are not using.
Checking connection to Docker...
Error creating machine: Error checking the host: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168
.99.101:2376": dial tcp 192.168.99.101:2376: connectex: No connection could be made because the target machine actively refused it.
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.
This issue is coming when connecting to vpn. Can anyone please help me with this issue?
Thanks,
Sanjiv
I'm running a CentOS-based container on Docker for Windows and trying to connect to an http service running on port 8545 of my host environment.
I've tried this, attempting a variety of suspected host names and IP addresses:
curl http://localhost:8545
But the error message I get is "curl: (7) Failed connect to localhost:8545; Connection refused"
How should I figure out what IP Address to use? Is there anything I need to configure as far as allowing the port number to be accessed from inside the container?
Localhost is not working yet I think with Docker for Windows.
There is few things you can try. First you can add EXPOSE 'portnumber' in the dockerfile so the container will listen on this port. You can also use docker run with -p 8545:8545, it will map the port of the container and the host.
To get the Ip address of the container you can use:
docker inspect -f "{{ .NetworkSettings.Networks.nat.IPAddress }}" containername
You can access the host using its ip but localhost/127.0.0.1 won't work (they will resolve to the Linux VM that is part of docker for windows). If you use the default network settings, your host should be reachable on 10.0.75.1 from your container
I am trying to set up docker machine on Windows and this problem has annoyed me for a few days.
I downloaded and installed DockerToolbox-1.9.1a on my Windows, so it came with Virtual Box version 5.0.10. After that I ran this command to create my virtual machine:
docker-machine create --driver virtualbox --engine-insecure-registry docker.pre-prod.ss.local:5000 --virtualbox-hostonly-cidr 192.168.99.100/24 mymachine
Here is what I got:
Waiting for machine to be running, this may take a few minutes...
Machine is running, waiting for SSH to be available... Detecting
operating system of created instance... Detecting the provisioner...
Provisioning created instance... Copying certs to the local machine
directory... Copying certs to the remote machine... Setting Docker
configuration on the remote daemon... WARNING >>> This machine has
been allocated an IP address, but Docker Machine could not reach it
successfully.
SSH for the machine should still work, but connecting to exposed
ports, such as the Docker daemon port (usually :2376), may not
work properly.
You may need to add the route manually, or use another related
workaround
This could be due to a VPN, proxy, or host file configuration issue.
You also might want to clear any VirtualBox host only interfaces you
are not using
The machine was created successfully. So I ran the docker-machine env command:
docker-machine env --shell=powershell mymachine| Invoke-Expression
and I got:
Error running connection boilerplate: Error checking and/or
regenerating the certs: There was icates for host
"192.168.99.100:2376": dial tcp 192.168.99.100:2376: connectex: No
connection target machine actively refused it. You can attempt to
regenerate them using 'docker-machine regenerate-certs name'. Be
advised that this will trigger a Docker daemon restart which will stop
running containers.
Running docker version returned
Client: Version: 1.9.1 API version: 1.21 Go version:
go1.4.3 Git commit: a34a1d5 Built: Fri Nov 20 17:56:04 UTC
2015 OS/Arch: windows/amd64 An error occurred trying to connect:
Get http://localhost:2375/v1.21/version: dial tcp connection could be
made because the target machine actively refused it.
Can someone help to point out the direction to fix this issue? It is really troublesome to set up docker on Windows. Thank you very much.
I use docker 1.9.1 on Windows (7, 8 and even 10), but without docker registry, and without using --virtualbox-hostonly-cidr.
If you are to use that last option, check "Set a specific address ip when i create a docker container", where I mention issue 1709, which uses cidr in .1, not .100 (but getting a .100 ip address as a result):
docker-machine create -d virtualbox --virtualbox-hostonly-cidr "192.168.99.1/24" m99
If there's no other machine with the same cidr (Classless Inter-Domain Routing), the machine should always get the .100 IP upon start.
I created two boot2docker instances in virtual box:
"boot2docker-vm" {8674bb87-b7ba-4179-9a09-c779611b1d9a}
"boot2docker-work" {53ffd6d6-2fc4-4c4f-b34e-c2f8dd87dd40}
They use different boot2docker.iso and different profiles.
The first vm is default, so if you run 'docker images' outside the virtual machine, it will use the first one by default.
But how can I access the second boot2docker "boot2docker-work", I know 'boot2docker ssh' works, but I want to run docker command outside the virtual machine.
I tried to set DOCKER_HOST and ca, cert for the second vm, but has the following errors:
An error occurred trying to connect: Get https://192.168.59.110:2376/v1.19/containers/json: dial tcp 192.168.59.110:2376: i/o timeout
Any ideas?
Ok,I find a solution.
when we create a VM, it will connect to a vboxnet with IP, if the ip is 192.168.59.103, it will add 192.168.59 to routing table
192.168.58 link#10 UC 3 0 vboxnet
then if we start the vm, 192.168.58.103 will be added to the routing table with right gateway:
192.168.58.103 8:0:27:1e:d1:24 UHLWI 0 3120 vboxnet 210
But if we create another vm with ip 192.168.58.104, then it will not have a right gateway:
192.168.58.104 link#10 UC 3 0 vboxnet
This makes the vm not working.
So my solution is that, use 192.168.59, or 192.168.60, then all problems gone.
But can anyone explain the routing mechanism of this?
first time poster, but have been very impressed with this community. I've spent an embarrassing amount of time this week trying to resolve this issue - there doesn't seem to be much info on the net & I am stuck. Thanks in advance for any insights!
I am moving an existing WLS application into Docker. Goal is to have a repeatable Dev environment with WLS inside container & those containers running inside Vagrant (custom RHEL 6.5 VirtualBox).
I configured & started WLS container. I am also able to access WLS services from the container on VM. However, when I try to access the container from the host, I receive a connection timeout error.
I am running a private network 10.10.10.41 on Vagrant with port forwarding 7771:7001 - if I access that IP:Port (as I normally would when running a service within Vagrant), I get a connection refused.
I am able to run WLS "natively" from the VM and access from the host successfully. I am also able to run Apache conatiners from within the VM and access them from the host successfully. So the issue appears specific to WLS running inside a container in VM.
I turned off the firewall on the VM, which I've read is a common issue with Vagrant + Docker.
I have a whole host of information to share, but rather than drink from the firehose I will start out with a couple pieces. Happy to attach any further info as necessary. Thanks again!
Vagrantfile
config.vm.network "private_network", ip: "10.10.10.41"
config.vm.network :forwarded_port, host: 7771, guest: 7001
Dockerfile
EXPOSE 7001
Dockerrun
docker run -d -p 7001:7001 -v /my/release:/domain/release --name "wladmin" --link wlmanaged:wlmanaged my/wladmin
Container IP
docker inspect -f '{{ .NetworkSettings.IPAddress }}' wladmin
172.17.0.13
nmap VM (localhost)
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000044s latency).
Other addresses for localhost (not scanned): 127.0.0.1
Not shown: 997 closed ports
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
111/tcp open rpcbind
nmap VM (Vagrant private network IP)
Nmap scan report for 10.10.10.41
Host is up (0.000053s latency).
Not shown: 998 closed ports
PORT STATE SERVICE
22/tcp open ssh
111/tcp open rpcbind
nmap WLS Docker Container
Nmap scan report for my.domain.com (172.17.0.11)
Host is up (0.000055s latency).
Not shown: 998 closed ports
PORT STATE SERVICE
7001/tcp open afs3-callback
7002/tcp open afs3-prserver
I found the root cause & wanted to share back.
It turns out that because Vagrant has a private network adapter, we have to bind the container to that adapter using.
docker run -d -p 10.10.10.41:7001:7001 -v /my/release:/domain/release --name "wladmin" --link wlmanaged:wlmanaged my/wladmin