⛅ Sync 2026-08-05 21:58:21

This commit is contained in:
github-actions[bot] committed 2026-08-05 21:58:21 +08:00
1 parent ca3fdb1643
commit 66ea3b0c46
734 files changed
+225296 -28

No files matched your search

@@ -0,0 +1,59 @@
#
# Dockerfile for shadowsocks-libev
#
FROM alpine
MAINTAINER kev <noreply@datageek.info>
ARG SS_VER=2.5.6
ARG SS_URL=https://github.com/shadowsocks/shadowsocks-libev/archive/v$SS_VER.tar.gz
ENV SERVER_ADDR 0.0.0.0
ENV SERVER_PORT 8388
ENV PASSWORD=
ENV METHOD aes-256-cfb
ENV TIMEOUT 300
ENV DNS_ADDR 8.8.8.8
ENV DNS_ADDR_2 8.8.4.4
RUN set -ex && \
apk add --no-cache --virtual .build-deps \
asciidoc \
autoconf \
build-base \
curl \
libtool \
linux-headers \
openssl-dev \
pcre-dev \
tar \
xmlto && \
cd /tmp && \
curl -sSL $SS_URL | tar xz --strip 1 && \
./configure --prefix=/usr --disable-documentation && \
make install && \
cd .. && \
runDeps="$( \
scanelf --needed --nobanner /usr/bin/ss-* \
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
| xargs -r apk info --installed \
| sort -u \
)" && \
apk add --no-cache --virtual .run-deps $runDeps && \
apk del .build-deps && \
rm -rf /tmp/*
USER nobody
EXPOSE $SERVER_PORT/tcp $SERVER_PORT/udp
CMD ss-server -s $SERVER_ADDR \
-p $SERVER_PORT \
-k ${PASSWORD:-$(hostname)} \
-m $METHOD \
-t $TIMEOUT \
--fast-open \
-d $DNS_ADDR \
-d $DNS_ADDR_2 \
-u
@@ -0,0 +1,88 @@
shadowsocks-libev
=================
[shadowsocks-libev][1] is a lightweight secured socks5 proxy for embedded
devices and low end boxes. It is a port of [shadowsocks][2] created by
@clowwindy maintained by @madeye and @linusyang.
Suppose we have a VPS running Debian or Ubuntu.
To deploy the service quickly, we can use [docker][3].
## Install docker
```
$ curl -sSL https://get.docker.com/ | sh
$ docker --version
```
## Build docker image
```bash
$ curl -sSL https://github.com/shadowsocks/shadowsocks-libev/raw/master/docker/alpine/Dockerfile | docker build -t shadowsocks-libev .
$ docker images
```
> You can also use a pre-built docker image: [vimagick/shadowsocks-libev][4] ![][5].
## Run docker container
```bash
$ docker run -d -e METHOD=aes-256-cfb -e PASSWORD=9MLSpPmNt -p 8388:8388 --restart always shadowsocks-libev
$ docker ps
```
> :warning: Click [here][6] to generate a strong password to protect your server.
## Use docker-compose to manage (optional)
It is very handy to use [docker-compose][7] to manage docker containers.
You can download the binary at <https://github.com/docker/compose/releases>.
This is a sample `docker-compose.yml` file.
```yaml
shadowsocks:
image: shadowsocks-libev
ports:
- "8388:8388"
environment:
- METHOD=aes-256-cfb
- PASSWORD=9MLSpPmNt
restart: always
```
It is highly recommended that you setup a directory tree to make things easy to manage.
```bash
$ mkdir -p ~/fig/shadowsocks/
$ cd ~/fig/shadowsocks/
$ curl -sSLO https://github.com/shadowsocks/shadowsocks-libev/raw/master/docker/alpine/docker-compose.yml
$ docker-compose up -d
$ docker-compose ps
```
## Finish
At last, download shadowsocks client [here][8].
Don't forget to share internet with your friends.
```yaml
{
"server": "your-vps-ip",
"server_port": 8388,
"local_address": "0.0.0.0",
"local_port": 1080,
"password": "9MLSpPmNt",
"timeout": 600,
"method": "aes-256-cfb"
}
```
[1]: https://github.com/shadowsocks/shadowsocks-libev
[2]: https://shadowsocks.org/en/index.html
[3]: https://github.com/docker/docker
[4]: https://hub.docker.com/r/vimagick/shadowsocks-libev/
[5]: https://badge.imagelayers.io/vimagick/shadowsocks-libev:latest.svg
[6]: https://duckduckgo.com/?q=password+12&t=ffsb&ia=answer
[7]: https://github.com/docker/compose
[8]: https://shadowsocks.org/en/download/clients.html
@@ -0,0 +1,9 @@
shadowsocks:
image: shadowsocks-libev
ports:
- "8388:8388/tcp"
- "8388:8388/udp"
environment:
- METHOD=aes-256-cfb
- PASSWORD=9MLSpPmNt
restart: always
@@ -0,0 +1,32 @@
FROM ubuntu:latest
MAINTAINER Sah Lee <contact@leesah.name>
ENV DEPENDENCIES git-core build-essential autoconf libtool libssl-dev asciidoc xmlto
ENV BASEDIR /tmp/shadowsocks-libev
ENV SERVER_PORT 8338
# Set up building environment
RUN apt-get update \
&& apt-get install -y $DEPENDENCIES
# Get the latest code, build and install
RUN git clone https://github.com/shadowsocks/shadowsocks-libev.git $BASEDIR
WORKDIR $BASEDIR
RUN ./configure \
&& make \
&& make install
# Tear down building environment and delete git repository
WORKDIR /
RUN rm -rf $BASEDIR/shadowsocks-libev\
&& apt-get --purge autoremove -y $DEPENDENCIES
# Port in the config file won't take affect. Instead we'll use 8388.
EXPOSE $SERVER_PORT
EXPOSE $SERVER_PORT/udp
# Override the host and port in the config file.
ADD entrypoint /
ENTRYPOINT ["/entrypoint"]
CMD ["-h"]
@@ -0,0 +1,90 @@
# Shadowsocks Dockerized
## About this image
This image is built to ease the deployment of the Shadowsocks server daemon with Docker.
For Shadowsocks clients, you want to visit http://shadowsocks.org/en/download/clients.html
### What is Shadowsocks
A secure socks5 proxy designed to protect your Internet traffic.
See http://shadowsocks.org/
### What is Docker
An open platform for distributed applications for developers and sysadmins.
See https://www.docker.com/
## How to use this image
### Start the daemon for the first time
```bash
$ docker run --name shadowsocks-app --detach --publish 58338:8338 shadowsocks/shadowsocks-libev -k "5ecret!"
```
To publish UDP port for DNS tunnelling, run
```bash
$ docker run --name shadowsocks-app --detach --publish 58338:8338 --publish 58338:8338/udp shadowsocks/shadowsocks-libev -k "5ecret!"
```
To see all supported arguments, run
```bash
$ docker run --rm shadowsocks/shadowsocks-libev --help
```
To try the bleeding edge version of Shadowsocks, run with an `unstable` tag
```bash
$ docker run --name shadowsocks-app --detach --publish 58338:8338 shadowsocks/shadowsocks-libev:unstable -k "5ecret!"
```
### Stop the daemon
```bash
$ docker stop shadowsocks-app
```
### Start a stopped daemon
```bash
$ docker start shadowsocks-app
```
### Upgrade
Simply run a `docker pull` to upgrade the image.
```bash
$ docker pull shadowsocks/shadowsocks-libev
```
### Use in CoreOS
COMING SOON
### Use with `fig`
COMING SOON
## Limitations
### JSON Configuration File
This image doesn't support the JSON configuration at the moment. But I do plan to add the support in the future. So please stay tuned.
### Specifying Hostname & Port
Docker containers don't have the power to specify on what hostname or port of the host should the service listen to. These have to be specified using the `--publish` argument of `docker run`.
See [Docker run reference](https://docs.docker.com/reference/run/#expose-incoming-ports) for more details.
## References
* [Shadowsocks - Servers](http://shadowsocks.org/en/download/servers.html)
* [shadowsocks-libev](https://github.com/shadowsocks/shadowsocks-libev/blob/master/README.md)
@@ -0,0 +1,99 @@
#! /bin/bash
IMAGE_NAME="leesah/shadowsocks-libev"
PORTNUMBER="8338"
SHADOWSOCKS="/usr/local/bin/ss-server"
HOST="-s 0.0.0.0"
PORT="-p $PORTNUMBER"
JSON=""
function print_usage {
echo
echo "Usage:"
echo " docker run $IMAGE_NAME [OPTIONS]"
echo
echo "OPTIONS"
echo " -k <password> password of your remote server"
echo
echo " [-m <encrypt_method>] encrypt method: table, rc4, rc4-md5"
echo " aes-128-cfb, aes-192-cfb, aes-256-cfb,"
echo " bf-cfb, camellia-128-cfb, camellia-192-cfb,"
echo " camellia-256-cfb, cast5-cfb, des-cfb, idea-cfb,"
echo " rc2-cfb, seed-cfb, salsa20 and chacha20"
echo " [-t <timeout>] socket timeout in seconds"
echo " [-c <config_file>] config file in json"
echo " [-u] enable udprelay mode"
echo " [-v] verbose mode"
echo
echo " [--fast-open] enable TCP fast open"
echo " [--acl <acl_file>] config file of ACL \(Access Control List\)"
echo
echo " [-h] print this"
echo
}
function print_usage_configfile {
echo "Config file is currently not supported by this image."
echo
echo "See https://github.com/leesah/shadowsocks-libev/issues/1 for current progress."
echo
}
function print_usage_host {
echo "To specify the host on which ss-server should listen, please use"
echo " docker run -p $1::$PORTNUMBER ..."
echo "or"
echo " docker run -p $1:<HOST-PORT>:$PORTNUMBER ..."
echo
echo "See manpage of docker-run for more details:"
echo " man docker-run"
echo
}
function print_usage_port {
echo "To specify the port on which ss-server should listen, please use"
echo " docker run -p $1:$PORTNUMBER ..."
echo
}
OPTIONS=`getopt -o s:p:k:m:t:c:uvh --long server:,key:,password:,encrypt-method:,timeout:,acl:,server-port:,config-file:,fast-open,help -n "$IMAGE_NAME" -- "$@"`
if [ $? -ne 0 ]; then
print_usage
exit 1
fi
eval set -- "$OPTIONS"
while true; do
case "$1" in
-k|--key|--password) PASSWORD="-k $2"; shift 2;;
-m|--encrypt-method) ENCRYPTION="-m $2"; shift 2;;
-t|--timeout) TIMEOUT="-t $2"; shift 2;;
--acl) ACL="--acl $2"; shift 2;;
--fast-open) FAST_OPEN="--fast-open"; shift;;
-u) UDP_RELAY="-u"; shift;;
-v) VERBOSE="-v"; shift;;
--) shift; break;;
-c|--config-file) print_usage_configfile; exit 128;;
-s|--server) print_usage_host "$2"; exit 128;;
-p|--server-port) print_usage_port "$2"; exit 128;;
-h|--help) print_usage; exit 0;;
*)
echo "$IMAGE_NAME: unexpected argument: $1"
print_usage
exit 1;;
esac
done
if [ -z "$HOST" -o -z "$PORT" -o -z "$PASSWORD" ]; then
echo "$IMAGE_NAME: insufficient arguments."
print_usage
exit 1
fi
echo "Launching Shadowsocks server..."
echo "To watch the output, run"
echo " docker ps -ql | xargs docker logs -f"
$SHADOWSOCKS $HOST $PORT $PASSWORD $ENCRYPTION $TIMEOUT $UDP_RELAY $VERBOSE $FAST_OPEN $ACL $JSON