Suddenly I can no longer connect to containers

Hi everyone,

Basically, I have a small server with Ubuntu server 20.04.6 LTS with docker installed for almost a year with which I have had no problems.
Suddenly without any changes on the server or docker (literally no changes at all) I can no longer connect to the containers. The only change that took place was the server’s ipv4 change due to a reset of the router. Solved by simply allocating the same ip to the server again (the change happened without any problems). After this, I was no longer able to connect.

As a result, I imagine that the problem is due to this ip change, but everything seems to be in order.

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.10.4)
  compose: Docker Compose (Docker Inc., v2.17.2)

Server:
 Containers: 25
  Running: 21
  Paused: 0
  Stopped: 4
 Images: 28
 Server Version: 20.10.24
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 2806fc1057397dbaeefbea0e4e17bddfbd388f38
 runc version:
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 5.4.0-148-generic
 Operating System: Ubuntu Core 22
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 7.556GiB
 Name: bad-server
 Docker Root Dir: /var/snap/docker/common/var-lib-docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No swap limit support

Please, explain what you mean by “connect to containers”.

From webbrowser? Using Docker exec? What error messages do you have?

I cannot connect from the browser, trying to connect locally with the server address with the port associated with the container. It gives me the screen, after a while, of connection denied “ERR_CONNECTION_REFUSED”. This happen for all.

The strange thing is that just on the network server side everything seems OK, I can connect to it, ping it, etc. I think the problem is on docker. I think that the ip change allocated by the router (reset to the one used previously) has thrown something off.

Chaning the host IP should not affect port forwards unless you forwarded ports from specific ip host IP and you have a different one. Other problem could be that you are trying to use a domain name to access the websites and the DNS record still points to the old IP address, but that would affect everything, not just Docker.

You could try to recreate all containers if you are using volumes for persistent data which is recommended…