mritd / dockerfile

some personally made dockerfile
https://hub.docker.com/u/mritd
MIT License
2.07k stars 647 forks source link

为什么我的ss-server运行一会儿就会失效? #35

Closed alexya closed 6 years ago

alexya commented 6 years ago

我在一个vm上安装了docker,然后用 mritd/shadowsocks这个image。 启动container后,我的客户端可以正常通过该ss-server:8388访问facebook & google,然后大约几十秒后,就不能正常工作了。 然后我 sudo docker exec -it f99dd2b85054 /bin/bash 到该container里面查看,发现ss-server的进程变成了[ss-server].

正常工作时,显示如下:

bash-4.4# ps aux | grep ss-server
    5 root       0:00 ss-server -s 0.0.0.0 -p 8388 -m aes-256-cfb -k barfoo! --fast-open
   11 root       0:00 grep ss-server

无法工作时,显示如下:

bash-4.4# ps aux | grep ss-server
    5 root       0:00 [ss-server]
   13 root       0:00 grep ss-server

请问一下,这个是怎么回事儿?谢谢!

mritd commented 6 years ago

有没有详细的 consul 日志?暂时从没出现过

mritd commented 6 years ago

@crankpin .....这个原因一般是链接被干扰了

mritd commented 6 years ago

@crankpin 走低位端口试试

alexya commented 6 years ago

@mritd 不好意思,不是很懂什么是'consul’日志?这个是vm上面的docker日志?还是container里面的ss的日志? 位置在哪里或者怎么打开? 或者,像楼上兄弟那样docker logs [container name] 谢谢!

mritd commented 6 years ago

@alexya 。。。额,回复你的时候正好在看 consul 文档......所以把 console 打成了 consul 😌

alexya commented 6 years ago

@mritd 我猜是console。 但我不知道你看什么的?ss-server运行的console日志么?貌似没有呢。 或者怎么让他显示出来?类似楼上的docker logs ss? 我去试试。

[updated]

sudo docker logs c4179a4a2542
Kcptun not started......
Starting shadowsocks......
 2018-01-03 15:23:44 INFO: using tcp fast open
sudo docker exec -it c4179a4a2542 /bin/bash
bash-4.4# ps aux
PID   USER     TIME   COMMAND
    1 root       0:00 {entrypoint.sh} /bin/bash /entrypoint.sh
    5 root       0:00 [ss-server]
    6 root       0:00 /bin/bash
   10 root       0:00 ps aux

And I attached my docker stack config:

version: '3'

services:
  server:
    image: mritd/shadowsocks
    ports:
      - "8388:8388"
      - "6500:6500/udp"
    environment:
      SS_MODULE: "ss-server"
      SS_CONFIG: "-s 0.0.0.0 -p 8388 -l 1080 -m aes-256-cfb -k barfoo! --fast-open"
      KCP_FLAG: "false"
      KCP_MODULE: "kcpserver"
      KCP_CONFIG: "-t 127.0.0.1:8388 -l :6500 -mode fast2 --log /var/log/kcpserver.log"

furthermore, I tried to use docker run -dt ... directly instead of docker stack, but got the same error. e.g.

bash-4.4# ps aux 
PID   USER     TIME   COMMAND
    1 root       0:00 {entrypoint.sh} /bin/bash /entrypoint.sh -m ss-server -s -s 0.0.0.0 -p 8388 -m aes-256-cfb -k barfoo! --fast-open
    5 root       0:00 kcpserver -t 127.0.0.1:8388 -l :6500 -mode fast2
    6 root       0:00 ss-server -s 0.0.0.0 -p 8388 -m aes-256-cfb -k barfoo! --fast-open
   10 root       0:00 /bin/bash
   15 root       0:00 ps aux
bash-4.4# ps aux 
PID   USER     TIME   COMMAND
    1 root       0:00 {entrypoint.sh} /bin/bash /entrypoint.sh -m ss-server -s -s 0.0.0.0 -p 8388 -m aes-256-cfb -k barfoo! --fast-open
    5 root       0:00 kcpserver -t 127.0.0.1:8388 -l :6500 -mode fast2
    6 root       0:00 [ss-server]
   10 root       0:00 /bin/bash
   16 root       0:00 ps aux
alexya commented 6 years ago

@mritd It should be my virtual machine's issue. I deleted it and re-created one, after running the container, I didn't find the issue.

ConserveLee commented 4 years ago

刚好看到这里, @alexya 请问关于ss到客户端到health check,consul有什么解决办法吗

mritd commented 4 years ago

@ConserveLee 没懂你什么意思,ss 作为网络 tunnel 使用?

ConserveLee commented 4 years ago

@ConserveLee 没懂你什么意思,ss 作为网络 tunnel 使用?

就是有多个ss-server的容器,consul可否检查哪个网络是连通的 @alexya

mritd commented 4 years ago

可以,请参考 https://www.consul.io/docs/agent/checks.html