Home

Awesome

Shadowsocks-libev Dockerfile

This Dockerfile build an image for shadowsocks-libev with v2ray-plugin, based on Alpine Linux.

Tags:

Quick Start

Get the docker image by running the following commands:

docker pull acrisliu/shadowsocks-libev

Start an instance:

docker run -d --name=shadowsocks-libev -p 8388:8388/tcp -p 8388:8388/udp --restart=always acrisliu/shadowsocks-libev

Setting a specific configration

You can use environment variables to specific configration.

For example, start a container with encrypt method aes-256-gcm and password YourPassword:

docker run -d \
-e METHOD=aes-256-gcm \
-e PASSWORD=YourPassword \
--name=shadowsocks-libev \
-p 8388:8388/tcp \
-p 8388:8388/udp \
--restart=always \
acrisliu/shadowsocks-libev

Available environment variables and default values:

Enable v2ray-plugin

By default, v2ray-plugin is disabled, use ARGS environment variable with --plugin, --plugin-opts arguments to enable it.

For example, if you want to enable v2ray-plugin with TLS mode and enable UDP relay:

docker run -d \
-e "ARGS=--plugin v2ray-plugin --plugin-opts server;tls;host=yourdomain.com;path=/v2ray;cert=/root/.acme.sh/yourdomain.com/fullchain.cer;key=/root/.acme.sh/yourdomain.com/yourdomain.com.key -u" \
-e PASSWORD=YourPassword \
-v /root/.acme.sh:/root/.acme.sh \
--user root \
--name=shadowsocks-libev \
-p 8388:8388/tcp \
-p 8388:8388/udp \
--restart=always \
acrisliu/shadowsocks-libev

Enable v2ray-plugin with QUIC mode:

It is recommended to increase the maximum buffer size by running:

sysctl -w net.core.rmem_max=2500000

This command would increase the maximum receive buffer size to roughly 2.5 MB.

docker run -d \
-e "ARGS=--plugin v2ray-plugin --plugin-opts server;mode=quic;host=yourdomain.com;path=/v2ray;cert=/root/.acme.sh/yourdomain.com/fullchain.cer;key=/root/.acme.sh/yourdomain.com/yourdomain.com.key" \
-e PASSWORD=YourPassword \
-v /root/.acme.sh:/root/.acme.sh \
--user root \
--name=shadowsocks-libev \
-p 8388:8388/tcp \
-p 8388:8388/udp \
--restart=always \
acrisliu/shadowsocks-libev

Attentions: if you want to enable v2ray-plugin QUIC mode, you must disable the UDP relay of ss-server, without -u argument in ARGS.

Remember mount your certs to container, recommend use acme.sh to issue certs.

For more v2ray-plugin configrations please go to v2ray plugin docs

With docker-compose

docker-compose.yml:

services:
  shadowsocks-libev:
    container_name: shadowsocks-libev
    image: acrisliu/shadowsocks-libev
    user: root
    ports:
      - "8388:8388/tcp"
      - "8388:8388/udp"
    volumes:
      - /root/.acme.sh:/root/.acme.sh:ro
    environment:
      - PASSWORD=YourPassword
      - ARGS=--plugin v2ray-plugin --plugin-opts server;tls;host=yourdomain.com;path=/v2ray;cert=/root/.acme.sh/yourdomain.com/fullchain.cer;key=/root/.acme.sh/yourdomain.com/yourdomain.com.key -u
    restart: always

How to upgrade

Just use bellow commands:

# Pull the latest image
docker pull acrisliu/shadowsocks-libev
# Stop and remove old container
docker stop shadowsocks-libev
docker rm shadowsocks-libev
# Start a new container with the latest image
docker run -d \
-e PASSWORD=YourPassword \
--name=shadowsocks-libev \
-p 8388:8388/tcp \
-p 8388:8388/udp \
--restart=always \
acrisliu/shadowsocks-libev