compose icon indicating copy to clipboard operation
compose copied to clipboard

Ubuntu 20.04 I can not connect ports after VMware suspend

Open berkayyildi opened this issue 5 years ago • 12 comments

Description of the issue

Ubuntu 20.04 I can not connect ports after VMware suspended then resumed. It require docker restart command to connect.

Context information (for bug reports)

Output of docker-compose version

docker-compose version 1.25.0, build unknown
docker-py version: 4.1.0
CPython version: 3.8.2
OpenSSL version: OpenSSL 1.1.1f  31 Mar 2020

Output of docker version

Client:
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.13.8
 Git commit:        afacb8b7f0
 Built:             Wed Mar 11 23:42:35 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          19.03.8
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.8
  Git commit:       afacb8b7f0
  Built:            Wed Mar 11 22:48:33 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.3.3-0ubuntu2
  GitCommit:        
 runc:
  Version:          spec: 1.0.1-dev
  GitCommit:        
 docker-init:
  Version:          0.18.0
  GitCommit:        

Additional information

Linux ubuntu 5.4.0-26-generic #30-Ubuntu SMP Mon Apr 20 16:58:30 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

berkayyildi avatar Apr 28 '20 12:04 berkayyildi

@berkayyildi : can you tell me more details on this? I would like to work on this. my email address: [email protected]

dinyadin avatar Apr 28 '20 20:04 dinyadin

@berkayyildi : can you tell me more details on this? I would like to work on this. my email address: [email protected]

I will give you more detailed info here. I use VMware® Workstation Technology Preview 20H1 Pro Version: e.x.p build-15679048

I use ubuntu-20.04-desktop-amd64.iso

There is no problem in 16.04, but 20.04 has network problem. When I suspend then resume I can't connect to containers. You can use any docker image to test but I realized while using this image

trafex/alpine-nginx-php7

While container working I can connect to port 80, I suspend and resume the VMware then I can not connect port 80 until I restart docker.

This is everything I know. When you try you will understand the problem easily.

berkayyildi avatar Apr 29 '20 12:04 berkayyildi

Hello,

I have the same issue when I moved from 18.04 to 20.04. I tested with plantuml/plantuml-server (configured with a tomcat container.

I use VMware® Workstation 15 Pro - 15.5.1 build-15018445.

docker version 19.03.13, build 4484c46d9d

docker-compose version 1.27.4, build 40524192

Thx.

pluguern avatar Oct 19 '20 14:10 pluguern

Hello, I noticed that my docker network interface disappears after a suspend resume.

Before (ifconfig): _``` docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255 inet6 fe80::42:37ff:fec3:feea prefixlen 64 scopeid 0x20 ether 02:42:37:c3:fe:ea txqueuelen 0 (Ethernet) RX packets 18 bytes 1647 (1.6 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 562 bytes 117634 (117.6 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

After (ifconfig): 
docker0: interface is no longer present.

pluguern avatar Oct 23 '20 13:10 pluguern

Same here

VMware:

VMware® Workstation 15 Pro
15.5.7 build-17171714

Docker:

Client: Docker Engine - Community
 Version:           20.10.6
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        370c289
 Built:             Fri Apr  9 22:46:38 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.6
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       8728dd2
  Built:            Fri Apr  9 22:44:49 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.4
  GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

As pointed by @pluguern, before suspend ip addr

4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether ##:##:##:##:##:## brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever

After suspend ip addr

4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether ##:##:##:##:##:## brd ff:ff:ff:ff:ff:ff

To workaround this issue, restarting Docker and NetworkManager services works

sudo docker stop $(sudo docker ps -aq) && sudo systemctl restart NetworkManager docker

mateuscelio avatar May 05 '21 18:05 mateuscelio

For me helped the tweak from this gist https://gist.github.com/lanrat/458066dbdeb460b9cef40dc2af639a24 It removes docker,vmware or other network interfaces from NetworkManager service. It works on my linux mint 20.2 (ubuntu 20.04).

thinkawitch avatar Aug 09 '21 19:08 thinkawitch

Hey @thinkawitch how / where do I use this config? What I am hoping to achieve is to suspend a VM without restarting docker so that I can make all the containers use TMPFS. Dont want to rebuild containers because tmpfs was lost during a restart.

b-hayes avatar May 04 '22 00:05 b-hayes

@b-hayes , the file is /etc/NetworkManager/NetworkManager.conf, the section is (in my case)

[keyfile]
unmanaged-devices=interface-name:docker*;interface-name:veth*;interface-name:br-*;interface-name:vmnet*;interface-name:vboxnet*

thinkawitch avatar May 04 '22 12:05 thinkawitch

@thinkawitch thanks a lot!

b-hayes avatar May 07 '22 09:05 b-hayes

Thx a lot.

pluguern314 avatar Jun 02 '22 08:06 pluguern314

I also stumbled upon this problem: interface docker0 losing IP address. I am on Ubuntu 22 as a guest in VMWare using open-vm-tools. The workaround described here didn't work for me. I am using now a different workaround which might be a bit harsh but it's working for me.

Create an executable file /etc/vmware-tools/scripts/resume-vm-default.d/01-docker_restart.sh

#!/bin/sh
systemctl restart docker

This will restart the whole docker daemon trigger by the open-vm-tools resume mechanism. It is probably not very elegant but at least it seems to work for me so far...

verybadsoldier avatar Aug 21 '22 20:08 verybadsoldier

Thank you !

pluguern314 avatar Aug 22 '22 07:08 pluguern314

I'm closing this issue as "not specific to docker compose"

ndeloof avatar May 03 '23 11:05 ndeloof

I also meet this issue on the Ubuntu Server 22.04 guest os in VMware Workstation 17.

I find another way is to change the default soft suspend mode to hard suspend mode for the VM, from VMware forum is to change the

The potential risk is IP conflicts, but I find it is good so far for my use cases.

leolcao avatar Oct 06 '23 10:10 leolcao