Leaseweb: после обновления виртуальной машины с Ubuntu 14.04 до 16.04, docker отказывается подключаться к localhost

Leaseweb: после обновления виртуальной машины с Ubuntu 14.04 до 16.04, docker отказывается подключаться к localhost

Я тут совсем запутался. После обновления до Ubuntu 16.04 с 14.04 на виртуальном сервере Leaseweb, docker больше не принимает соединения с localhost. Используя оригинальный образ сервера CouchBase, запуск следующей команды на моем ноутбуке работает отлично (версия Docker 1.12.1, сборка 23cf638):

$ docker run --rm -ti --name couchbase-server -p 127.0.0.1:8091:8091 couchbase/server:community-4.5.0
Starting Couchbase Server -- Web UI available at http://<ip>:8091 and logs available in /opt/couchbase/var/lib/couchbase/logs

$ curl localhost:8091
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><html><head><title>301 Moved Permanently</title></head><body><h1>Moved Permanently</h1><p>The document has moved <a href="http://localhost:8091/ui/index.html>here</a>.</p></body></html>

Однако когда я запускаю ту же самую команду на моей виртуальной машине Ubuntu 16.04, размещенной на Leaseweb (тот же Docker версии 1.12.1, сборка 23cf638), происходит сбой:

# curl localhost:8091
curl: (7) Failed to connect to localhost port 8091: Connection refused
# netstat -tnlp|grep 8091
tcp        0      0 127.0.0.1:8091          0.0.0.0:*               LISTEN      7387/docker-proxy
# iptables -t nat -L                                                                                                                                                                  
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination         
REDIRECT   tcp  --  anywhere             anywhere             tcp dpt:http redir ports 8080
REDIRECT   tcp  --  anywhere             anywhere             tcp dpt:https redir ports 8443
DOCKER     all  --  anywhere             anywhere             ADDRTYPE match dst-type LOCAL

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
DOCKER     all  --  anywhere            !127.0.0.0/8          ADDRTYPE match dst-type LOCAL

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination         
MASQUERADE  all  --  172.17.0.0/16        anywhere            
MASQUERADE  all  --  172.18.0.0/16        anywhere            
MASQUERADE  tcp  --  172.17.0.2           172.17.0.2           tcp dpt:8091

Chain DOCKER (2 references)
target     prot opt source               destination         
RETURN     all  --  anywhere             anywhere            
RETURN     all  --  anywhere             anywhere            
DNAT       tcp  --  anywhere             localhost            tcp dpt:8091 to:172.17.0.2:8091

Однако когда я открываю порт для публики, он начинает работать:

# docker run --rm -ti --name couchbase-server -p 8091:8091 couchbase/server:community-4.5.0
# netstat -tnlp|grep 8091
tcp6       0      0 :::8091                 :::*                    LISTEN      15434/docker-proxy
# curl localhost:8091
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><html><head><title>301 Moved Permanently</title></head><body><h1>Moved Permanently</h1><p>The document has moved <a href="http://localhost:8091/ui/index.html>here</a>.</p></body></html>
# iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination         
REDIRECT   tcp  --  anywhere             anywhere             tcp dpt:http redir ports 8080
REDIRECT   tcp  --  anywhere             anywhere             tcp dpt:https redir ports 8443
DOCKER     all  --  anywhere             anywhere             ADDRTYPE match dst-type LOCAL

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
DOCKER     all  --  anywhere            !127.0.0.0/8          ADDRTYPE match dst-type LOCAL

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination         
MASQUERADE  all  --  172.17.0.0/16        anywhere            
MASQUERADE  all  --  172.18.0.0/16        anywhere            
MASQUERADE  tcp  --  172.17.0.2           172.17.0.2           tcp dpt:8091

Chain DOCKER (2 references)
target     prot opt source               destination         
RETURN     all  --  anywhere             anywhere            
RETURN     all  --  anywhere             anywhere            
DNAT       tcp  --  anywhere             anywhere             tcp dpt:8091 to:172.17.0.2:8091

Единственное отличие в последней строке, destination anywhereVS. localhostОднако на моей домашней машине соответствующее правило iptables говорит localhostто же самое, и оно работает. Фактически, на моей домашней машине правила iptables абсолютно такие же, но они работают. Домашняя машина использует более новое ядро ​​(4.8.0-34-generic против 4.4.0-59-generic на виртуальной машине) и работает на голом железе против паравиртуализации на виртуальной машине. Может быть, это так? Поддержка говорит, что вышеизложенное работает безупречно на виртуальной машине Ubuntu 14.04, может быть, мне не стоило обновляться...

Связанный контент