Docker Community Forums

Share and learn in the Docker community.

Cannot connect to mapped port on localhost IP


(Vaclavkasal) #1

Hello,

Localhost IP: I can connect to mapped http port(:80) but I cannot connect to mapped :10051. I can’t understand why one is working and one not.
Container IP: Connecting to :10051 through container IP is working, so there should not be problem with port itself.

Here is what I’m doing:

root@prod1:~/zabbix-docker# telnet 172.18.0.5 10051
Trying 172.18.0.5...
Connected to 172.18.0.5.
Escape character is '^]'.

root@prod1:~/zabbix-docker# telnet 127.0.0.1 10051
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused

This is my compose file ubuntu-zabbix.yml:

version: '3.1'

services:

  db:
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: example

  zbx-backend:
    image: zabbix/zabbix-server-mysql:ubuntu-3.0-latest
    restart: always
    environment:
      DB_SERVER_HOST: db
      MYSQL_ROOT_PASSWORD: example
      MYSQL_USER: zabbix
      MYSQL_PASSWORD: zabbix
      MYSQL_DATABASE: zabbix
    depends_on:
      - db
    ports:
      - 10050:10050
      - 10051:10051

  zbx-frontend:
    image: zabbix/zabbix-web-nginx-mysql:ubuntu-3.0-latest
    restart: always
    environment:
      DB_SERVER_HOST: db
      ZBX_SERVER_HOST: zbx-backend
      MYSQL_ROOT_PASSWORD: example
      MYSQL_USER: zabbix
      MYSQL_PASSWORD: zabbix
      MYSQL_DATABASE: zabbix
    depends_on:
      - db
      - zbx-backend
    ports:
      - 80:80

Run it by command

docker-compose -f ubuntu-zabbix.yml up

Any idea what is going on? I ask before turning on debug, in hope it is something common.

OS Version/build:
Ubuntu 16.04.4/Docker version 18.03.0-ce, build 0520e24


(Vaclavkasal) #2

I have found the reason, it’s docker or docker-compose bug. https://stackoverflow.com/a/49957850/5380338