I installed docker on my ubuntu 14.04 laptop. I pulled the docker registry image from the central registry. To fix the IP address of the container to a static value, I first changed mine /etc/defaults/dockerand added the variable -e lxcto DOCKER_OPTS.
Then, to run my local registry, I used the following command:
docker run \
-i -t -h myreg \
--net="none" \
--lxc-conf="lxc.network.hwaddr=91:21:de:b0:6b:61" \
--lxc-conf="lxc.network.type = veth" \
--lxc-conf="lxc.network.ipv4 = 172.17.0.20/16" \
--lxc-conf="lxc.network.ipv4.gateway = 172.17.42.1" \
--lxc-conf="lxc.network.link = docker0" \
--lxc-conf="lxc.network.name = eth0" \
--lxc-conf="lxc.network.flags = up" \
--name myreg \
-p 5000:5000 \
-d registry \
/bin/bash
Then used docker attach myregto access the container shell. After installing the net-tools package, I checked its IP address and saw that it was 172.17.0.20, as expected. I tried to scan it from my master, and he answered.
The problem is that when I checked the configuration of this container with docker inspect myreg, part of the NetworkSettings output was as follows
"NetworkSettings": {
"Bridge": "docker0",
"Gateway": "172.17.42.1",
"IPAddress": "172.17.0.8",
"IPPrefixLen": 16,
"PortMapping": null,
"Ports": {
"5000/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "5000"
}
]
}
172.17.0.8 IP-. , , usign lxc driver. , docker push, . docker IP-
de7e1cfc] +job push(127.0.0.1:5000/mongo)
2014/07/18 17:10:19 Can't forward traffic to backend tcp/172.17.0.8:5000: dial tcp 172.17.0.8:5000: no route to host
2014/07/18 17:10:22 Can't forward traffic to backend tcp/172.17.0.8:5000: dial tcp 172.17.0.8:5000: no route to host
? smt. ?