Docker sets up port mapping, but cannot access the solution

Docker sets up port mapping, but cannot access the solution

#docker ps check, all ports are mapped

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
764b158ba491 open-falcon-plus-02:v-daiyi-01 "/bin/bash" 2 days ago Up 3 hours 0.0.0.0:4444->4444/tcp, 0.0.0.0:6030-6031->6030-6031/tcp, 0.0.0.0:6070-6071->6070-6071/tcp, 0.0.0.0:6080-6081->6080-6081/tcp, 0.0.0.0:8080-8081->8080-8081/tcp, 0.0.0.0:8433->8433/tcp, 0.0.0.0:9912->9912/tcp, 0.0.0.0:14444->14444/tcp, 0.0.0.0:16060->16060/tcp, 0.0.0.0:18433->18433/tcp, 8082/tcp open-falcon-plus-daiyi-01

#But check the log

tail -40 /home/work/open-falcon/agent/logs/agent.log
test@ubuntu-10:/tmp/bak$ tail -40 /home/work/open-falcon/agent/logs/agent.log
2018/10/14 20:27:09 transfer.go:48: call Transfer.Update fail: &{{2 1} <nil> 10.0.10.103:8433 1s} dial tcp 10.0.10.103:8433: getsockopt: connection refused
2018/10/14 20:27:09 var.go:95: <= <Total=0, Invalid:0, Latency=0ms, Message:>
2018/10/14 20:27:09 rpc.go:41: dial 10.0.10.103:8433 fail: dial tcp 10.0.10.103:8433: getsockopt: connection refused
2018/10/14 20:27:11 rpc.go:41: dial 10.0.10.103:8433 fail: dial tcp 10.0.10.103:8433: getsockopt: connection refused
2018/10/14 20:27:15 rpc.go:41: dial 10.0.10.103:8433 fail: dial tcp 10.0.10.103:8433: getsockopt: connection refused
2018/10/14 20:27:23 rpc.go:41: dial 10.0.10.103:8433 fail: dial tcp 10.0.10.103:8433: getsockopt: connection refused
2018/10/14 20:27:23 transfer.go:48: call Transfer.Update fail: &{{0 0} <nil> 10.0.10.103:8433 1s} dial tcp 10.0.10.103:8433: getsockopt: connection refused
2018/10/14 20:27:23 var.go:95: <= <Total=0, Invalid:0, Latency=0ms, Message:>
2018/10/14 20:27:41 var.go:88: => <Total=92> <Endpoint:ubuntu, Metric:agent.alive, Type:GAUGE, Tags:, Step:60, Time:1539574061, Value:1>
2018/10/14 20:27:41 var.go:88: => <Total=5> <Endpoint:ubuntu, Metric:df.bytes.free.percent, Type:GAUGE, Tags:mount=/,fstype=ext4, Step:60, Time:1539574061, Value:67.01861018345224>

But can't access

reason:

The host in docker cannot be configured with 127.0.0.1 or 192.168.0.1 or the host machine will not be able to access the port

Modify the configuration file - (all those involved and requiring external access need to be modified)

[root@ubuntu-10 open-falcon]# vim transfer/config/cfg.json
{
  "debug": true,
  "minStep": 30,
  "http": {
    "enabled": true,
    "listen": "0.0.0.0:6060"
  },
  "rpc": {
    "enabled": true,
    "listen": "0.0.0.0:8433" **#Listen to external 8433 here. Change to 0.0.0.0**
  },
  "socket": {
    "enabled": true,
    "listen": "0.0.0.0:4444",
    "timeout": 3600
  },
  "judge": {
    "enabled": true,
    "batch": 200,
    "connTimeout": 1000,
    "callTimeout": 5000,
    "maxConns": 32,
    "maxIdle": 32,
    "replicas": 500,
    "cluster": {
      "judge-00" : "127.0.0.1:6080"
    }
  },
  "graph": {
    "enabled": true,
    "batch": 200,
    "connTimeout": 1000,
    "callTimeout": 5000,
    "maxConns": 32,
    "maxIdle": 32,
    "replicas": 500,
    "cluster": {
      "graph-00" : "127.0.0.1:6070"
    }
  },
  "tsdb": {
    "enabled": false,
    "batch": 200,
    "connTimeout": 1000,
    "callTimeout": 5000,
    "maxConns": 32,
    "maxIdle": 32,
    "retry": 3,
    "address": "127.0.0.1:8088"
  }

After modification, restart the service in docker

[root@ubuntu-10 open-falcon]# ./open-falcon restart transfer

Check the log again

test@ubuntu-10:/tmp/bak$ tail -40 /home/work/open-falcon/agent/logs/agent.log 
2018/10/15 02:52:48 var.go:88: => <Total=1> <Endpoint:test-endpoint, Metric:test-metric-97, Type:GAUGE, Tags:idc=lgi-test,loc=beijing-test, Step:20, Time:1539597168, Value:33>
2018/10/15 02:52:48 var.go:95: <= <Total=1, Invalid:0, Latency=0ms, Message:ok>
2018/10/15 02:52:48 var.go:88: => <Total=1> <Endpoint:test-endpoint, Metric:test-metric-97, Type:GAUGE, Tags:idc=lgi-test,loc=beijing-test, Step:20, Time:1539597168, Value:33>
2018/10/15 02:52:48 var.go:95: <= <Total=1, Invalid:0, Latency=0ms, Message:ok>
2018/10/15 02:52:48 var.go:88: => <Total=1> <Endpoint:test-endpoint, Metric:test-metric-97, Type:GAUGE, Tags:idc=lgi-test,loc=beijing-test, Step:20, Time:1539597168, Value:33>
2018/10/15 02:52:48 var.go:95: <= <Total=1, Invalid:0, Latency=0ms, Message:ok> #Connection successful, data incoming.

Check the port connectivity

test@ubuntu-10:/tmp/bak$ telnet 10.0.10.103 8433
Trying 10.0.10.103...
Connected to 10.0.10.103.
Escape character is '^]'. #This is ok

OK~ You can connect successfully.

Supplement: The docker image was started successfully but cannot be accessed

Solution:

vi /etc/sysctl.conf or

vi /usr/lib/sysctl.d/00-system.conf Add the following code:

net.ipv4.ip_forward=1

Restart the network service

systemctl restart network to check whether the modification is successful

sysctl net.ipv4.ip_forward If the return value is "net.ipv4.ip_forward = 1", it means success.

The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. If there are any mistakes or incomplete considerations, please feel free to correct me.

You may also be interested in:
  • Docker port mapping and external inaccessibility issues
  • How to achieve network access with Docker port mapping
  • Docker enables multiple port mapping commands
  • Docker volumes file mapping method
  • Docker file storage path, modify port mapping operation mode
  • Docker primary network port mapping configuration
  • How to modify the port mapping of a running Docker container

<<:  Usage of the target attribute of the html tag a

>>:  IE8 browser will be fully compatible with Web page standards

Recommend

How to use VIM editor in Linux

As a powerful editor with rich options, Vim is lo...

Detailed explanation of JavaScript Reduce

Table of contents map filter some every findIndex...

How to install Android x86 in vmware virtual machine

Sometimes you just want to test an app but don’t ...

Detailed explanation of how to monitor MySQL statements

Quick Reading Why do we need to monitor SQL state...

Vue encapsulation component upload picture component

This article example shares the specific code of ...

How to choose the right MySQL datetime type to store your time

When building a database and writing a program, i...

A brief understanding of the relevant locks in MySQL

This article is mainly to take you to quickly und...

Tutorial on using the frameset tag in HTML

Frameset pages are somewhat different from ordina...

Example of using js to natively implement year carousel selection effect

Preface Use js to achieve a year rotation selecti...

Issues with Rancher deployment and importing K8S clusters

Rancher deployment can have three architectures: ...

Detailed explanation of HTML tables

Function: data display, table application scenari...

Docker container custom hosts network access operation

Adding the extra_hosts keyword in docker-compose....

Install mysql5.7.17 using RPM under Linux

The installation method of MySQL5.7 rpm under Lin...

Encapsulate a simplest ErrorBoundary component to handle react exceptions

Preface Starting from React 16, the concept of Er...

Analysis of the project process in idea packaging and uploading to cloud service

one. First of all, you have to package it in idea...