0

I couldn’t access nginx on port 8080. In general, I can’t access any container.

  • CentOS Linux 7
  • Docker version 19.03.13, build 4484c46d9d

containers

CONTAINER ID        IMAGE                    COMMAND                  CREATED             STATUS              PORTS                                            NAMES
b0ce058600e6        nginx                    "/docker-entrypoint.…"   9 hours ago         Up 9 hours          0.0.0.0:8080->80/tcp                             web
1fc09982cb16        portainer/portainer-ce   "/portainer"             10 hours ago        Up About a minute   0.0.0.0:8000->8000/tcp, 0.0.0.0:9000->9000/tcp   portainer

error

curl http://localhost:8080
curl: (56) Recv failure: Connection reset by peer

nginx container:

/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
 10-listen-on-ipv6-by-default.sh: Getting the checksum of 
/etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: Enabled listen on IPv6 in 
/etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Configuration complete; ready for start up

same with portainer

iptables

-P INPUT ACCEPT
-P FORWARD DROP
-P OUTPUT ACCEPT
-N DOCKER
-N DOCKER-ISOLATION-STAGE-1
-N DOCKER-ISOLATION-STAGE-2
-N DOCKER-USER
-A FORWARD -j DOCKER-USER
-A FORWARD -j DOCKER-ISOLATION-STAGE-1
-A FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -o docker0 -j DOCKER
-A FORWARD -i docker0 ! -o docker0 -j ACCEPT
-A FORWARD -i docker0 -o docker0 -j ACCEPT
-A FORWARD -o br-e080a2054aa8 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -o br-e080a2054aa8 -j DOCKER
-A FORWARD -i br-e080a2054aa8 ! -o br-e080a2054aa8 -j ACCEPT
-A FORWARD -i br-e080a2054aa8 -o br-e080a2054aa8 -j ACCEPT
-A DOCKER -d 172.17.0.3/32 ! -i docker0 -o docker0 -p tcp -m tcp --dport 80 -j ACCEPT
-A DOCKER -d 172.17.0.2/32 ! -i docker0 -o docker0 -p tcp -m tcp --dport 9000 -j ACCEPT
-A DOCKER -d 172.17.0.2/32 ! -i docker0 -o docker0 -p tcp -m tcp --dport 8000 -j ACCEPT
-A DOCKER-ISOLATION-STAGE-1 -i docker0 ! -o docker0 -j DOCKER-ISOLATION-STAGE-2
-A DOCKER-ISOLATION-STAGE-1 -i br-e080a2054aa8 ! -o br-e080a2054aa8 -j DOCKER-ISOLATION-STAGE-2
-A DOCKER-ISOLATION-STAGE-1 -j RETURN
-A DOCKER-ISOLATION-STAGE-2 -o docker0 -j DROP
-A DOCKER-ISOLATION-STAGE-2 -o br-e080a2054aa8 -j DROP
-A DOCKER-ISOLATION-STAGE-2 -j RETURN
-A DOCKER-USER -j RETURN

But it not work

Hes
  • 11
  • 4
  • Are you exposing your ports when running the containers? Can you post your `docker-compose.yml` file or the cli command you use to run the container? – Lateralus Nov 14 '20 at 02:43
  • @Kickin_Wing i used this command `docker run -it --rm -d -p 8080:80 --name web nginx` – Hes Nov 14 '20 at 09:31
  • I was able to download those images and run them successfully using the same command. It's leading me to believe that you might have a configuration issue with docker. Can you try running `curl 0.0.0.0:8080` and see if that gives you a response? I found this question which might be helpful: https://stackoverflow.com/questions/26543787/docker-mule-server-curl-56-recv-failure-connection-reset-by-peer/26553296#26553296 – Lateralus Nov 14 '20 at 16:45
  • @Kickin_Wing `[root@docker_analyses ~]# curl 0.0.0.0:8080 curl: (56) Recv failure: Connection reset by peer` – Hes Nov 16 '20 at 14:05
  • @Kickin_Wing, when run `tcpdump -i docker0` all work. Unfortunately, I do not have enough knowledge to understand why this is happening. – Hes Nov 17 '20 at 20:15
  • you might need to head over to https://superuser.com/ or https://forums.docker.com/. – Lateralus Nov 17 '20 at 20:18

1 Answers1

0

Everything works. Probably the problem was in the firewalld.

Hes
  • 11
  • 4