Replying to Avatar Yonle

It's right in the web.

https://bostr.lecturify.net

Currently still on testing at master branch

然后docker运行命令 github readme里面那个docker run --rm --name bostr那个命令,之前运行起来,更新版本后不知道本地访问不了8080端口,重新pull也访问不了。

请问怎么排查问题

Use docker runs the command github readme, the docker run --rm --name bostr command, and after updating the version, I don't know that why the local port 8080 cannot be accessed, even repull cannot be accessed.

May I kindly ask how can I troubleshoot the problem?please give me some basic steps.

Reply to this note

Please Login to reply.

Discussion

docker ps -a看下旧的版本docker还在不在跑,如果在的话stop一下,不然端口还被占用。

如果不在了,看下新版本的端口映射打开了没有,docker ps 命令应该会展示port信息。如果没有,可以配置一下端口映射。

也可以用ss -antp | grep LIST命令看一下8080端口有没有进程在监听。如果有,可以看下是不是docker进程。如果是可以尝试下curl 127.0.0.1:8080看下有没有返回啥信息。

docker里面创建两个容器,cloudflare和另一个容器端口通信,建立防火墙关系嘛?关键是之前2.1.4之前那个版本直接建立的通信,运行起来了。

防火墙默认的iptables没动过。

LISTEN 0 4096 [::]:8080 [::]:* users:(("docker-proxy",pid=140718,fd=4))

LISTEN 0 4096 0.0.0.0:8080 0.0.0.0:* users:(("docker-proxy",pid=140705,fd=4))

其他教程建议

sudo ufw status

inactive

sudo iptables -L

Chain FORWARD (policy DROP)

target prot opt source destination

DOCKER-USER all -- anywhere anywhere

DOCKER-ISOLATION-STAGE-1 all -- anywhere anywhere

ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED

DOCKER all -- anywhere anywhere

ACCEPT all -- anywhere anywhere

ACCEPT all -- anywhere anywhere

Chain OUTPUT (policy ACCEPT)

target prot opt source destination

Chain DOCKER (1 references)

target prot opt source destination

ACCEPT tcp -- anywhere 172.17.0.2 tcp dpt:9443

ACCEPT tcp -- anywhere 172.17.0.2 tcp dpt:8000

ACCEPT tcp -- anywhere 172.17.0.3 tcp dpt:http-alt

Chain DOCKER-ISOLATION-STAGE-1 (1 references)

target prot opt source destination

DOCKER-ISOLATION-STAGE-2 all -- anywhere anywhere

RETURN all -- anywhere anywhere

Chain DOCKER-ISOLATION-STAGE-2 (1 references)

target prot opt source destination

DROP all -- anywhere anywhere

RETURN all -- anywhere anywhere

Chain DOCKER-USER (1 references)

target prot opt source destination

RETURN all -- anywhere anywhere ,其中172.17.0.3是都docker里面的cloudflared,9443是portainer端口

curl能curl通127.0.0.1:8080

你这3个容器有点复杂了,搞不懂,不过yonle说docker部署方式他已经不维护了,不知道新版本的docker镜像还能不能用,你可以尝试回退到旧版本跑起来试试看,如果可以的话那估计是新版本镜像有问题。

新消息:cloudflared不用docker居然可以连接

我看应该是docker的防火墙问题 docker依赖iptables.

502 bad gateway.

--rm是一次性的,停止容器就删除了。使用 -d 后台运行。

我看到了,我有portainer,我用的-d。最新情况是cloudflared运行在宿主机连接bostr服务成功。docker里面防火墙不会调。

docker build -t bostr:local .

docker run -d --name bostr -p 8080:8080 -v ./config.js:/usr/src/app/config.js bostr:local

docker run -d --name cloudflared-tunnel --restart unless-stopped \

--network=bridge \

-e TUNNEL_URL="http://localhost:8080" \

-e TUNNEL_TOKEN="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \

-v /etc/localtime:/etc/localtime:ro \

-v /cloudflared:/home/dell/.cloudflared \

cloudflare/cloudflared:latest tunnel run

你不是部署在公网的啊

前面套了一层cloudflare纯粹是防攻击和刷流量哈哈哈。别的防火墙咱不会哈哈,我就一学机械的工科生哈哈哈。

那个localhost被其实是替换字眼。