I’m trying to install Docker with a structure of 2 webservers and a common bridge network between them under Ubuntu 20.04.
But for some unknown reason, I get connection timeouts, even if the application is running normally.
To debug this issue, I’ve installed a fresh image of Ubuntu from my VPS vendor and installed Docker with the convenience script get-docker.sh
from https://get.docker.com running it as root.
I’ve also enabled IPV6 support to Docker, creating the file /etc/docker/daemon.json with this content:
{
“ipv6”: true,
“fixed-cidr-v6”: “2001:db8:1::/64”
}
After that, I’ve configured ufw firewall with these settings:
sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
sudo ufw allow smtp
sudo ufw allow submission
sudo ufw allow submissions
sudo ufw allow pop3
sudo ufw allow pop3s
sudo ufw allow imap2
sudo ufw allow imaps
sudo ufw allow 4190/tcp
sudo ufw allow 8080/tcp
Rebooted the server and created the following docker-composer.yaml file:
BEGIN
version: ‘2.1’
services:
S2:
image: nginx:latest
ports:
- 80:80
restart: always
networks:
n1:
ipv4_address: 172.22.1.254
aliases:
- s2
S3:
image: nginx:latest
ports:
- 8080:80
restart: always
networks:
n1:
ipv4_address: 172.22.1.248
aliases:
- s3
networks:
n1:
driver: bridge
driver_opts:
com.docker.network.bridge.name: n1
enable_ipv6: true
ipam:
driver: default
config:
- subnet: 172.22.1.0/24
- subnet: fd4d:6169:6c63:6f77::/64
END
So I started the containers with docker-compose up -d
When I execute curl localhost 80
on the Host server, it shows the default index.html from nginx, but the connection gets stuck !
After some minutes, the following message is shown:
curl: (28) Failed to connect to 80 port 80: Connection timed out
When I execute curl <myhostname.com> 80
from my local computer, it shows the same default index.html, but at the end it returns this message:
curl: (7) Failed to connect to 0.0.31.144 port 80 after 1 ms: Network unreachable
I tried also curl localhost 8080
and the result is the same, after some minutes:
curl: (28) Failed to connect to 8080 port 80: Connection timed out
Any clue about why these timeouts are occurring?
Thanks!