shadowsocks / shadowsocks-rust

A Rust port of shadowsocks
https://shadowsocks.org/
MIT License
8.67k stars 1.18k forks source link

The Docker version of sslocal-rust does not work #1652

Closed xiebin2014 closed 2 months ago

xiebin2014 commented 2 months ago

config.json

{
    "servers": [{
        "server": "xxxx",
        "server_port": 29156,
        "mode": "tcp_and_udp",
        "password": "xx",
        "method": "rc4-md5",
        "timeout": 300
    }, {
        "server": "xxx",
        "server_port": 29156,
        "mode": "tcp_and_udp",
        "password": "xxx",
        "method": "rc4-md5",
        "timeout": 300
    }],
    "local_address": "127.0.0.1",
    "local_port": 1080,
    "protocol": "http",
}

docker-compose

version: '3.8'

services:
  sslocal-rust:
    image: ghcr.io/shadowsocks/sslocal-rust:latest
    container_name: sslocal-rust
    # command: --local-http
    ipc: host
    ports:
      - "1688:1080"
    volumes:
      - /path/dockers/sslocal-rust/shadowsocks-rust:/etc/shadowsocks-rust
    cap_drop:
      - ALL
    cap_add:
      - NET_BIND_SERVICE
    stdin_open: true
    tty: true
    restart: unless-stopped
    networks:
      - bridge
networks:
  bridge:
    external:
      name: docker_default

Using export http_proxy=http://127.0.0.1:1080 inside the container works. Using export http_proxy=http://172.17.0.1:1688 in other containers does not work.

wget www.google.com
--2024-09-13 06:42:12--  http://www.google.com/
Connecting to 172.17.0.1:1688... connected.
Proxy request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

--2024-09-13 06:42:13--  (try: 2)  http://www.google.com/
Connecting to 172.17.0.1:1688... connected.
Proxy request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

whats the possible reasons

zonyitoo commented 2 months ago

It looks like a Docker specific problem, you may find you answer in Docker's community.

xiebin2014 commented 2 months ago

It looks like a Docker specific problem, you may find you answer in Docker's community.

image

No ports exposed in this image Does this matter

xiebin2014 commented 2 months ago

i found the bug

in config.json

address should be 0.0.0.0, i used 127.0.0.1