From 23b6a24bba9b8255d62b330d092edaab81604df2 Mon Sep 17 00:00:00 2001 From: Sah Date: Thu, 1 Jan 2015 19:31:10 +0800 Subject: [PATCH] Dockerize Shadowsocks - Dockerfile: builds a Shadowsocks image - shadowsocks.json default config file - README.md: describing the usage of the image --- docker/Dockerfile | 38 ++++++++++++++++++++++++ docker/README.md | 64 +++++++++++++++++++++++++++++++++++++++++ docker/shadowsocks.json | 5 ++++ 3 files changed, 107 insertions(+) create mode 100644 docker/Dockerfile create mode 100644 docker/README.md create mode 100644 docker/shadowsocks.json diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..95c8235 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,38 @@ +FROM ubuntu:latest + +MAINTAINER Sah Lee + +ENV BASEDIR /tmp +ENV CONFIGDIR /etc/shadowsocks +ENV CONFIGFILE $CONFIGDIR/shadowsocks.json +ENV PORT 8388 + +# Install dependencies +RUN apt-get update +RUN apt-get install -y python python-pkg-resources + +# Set up building environment +RUN apt-get install -y git-core python-setuptools + +# Get the latest code, build and install +WORKDIR $BASEDIR +RUN git clone https://github.com/shadowsocks/shadowsocks.git +WORKDIR $BASEDIR/shadowsocks +RUN pwd +RUN python setup.py build +RUN python setup.py install + +# Tear down building environment and delete git repository +WORKDIR $BASEDIR +RUN apt-get --purge autoremove -y git-core python-setuptools +RUN rm -rf $BASEDIR/shadowsocks + +# Config file can be in a separated container +VOLUME ["$CONFIGDIR"] +ADD shadowsocks.json $CONFIGFILE + +# Port in the config file won't take affect. Instead we'll use 8388. +EXPOSE $PORT + +# Override the host and port in the config file. +CMD ssserver --fast-open -c $CONFIGFILE -s 0.0.0.0 -p $PORT diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..8e9e435 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,64 @@ +# Shadowsocks Dockerized + +## 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 firt time + +Pull the image. + +```bash +$ docker pull leesah/shadowsocks +``` + +Create a data container and edit the configuration file. + +```bash +$ docker run --name shadowsocks-data leesah/shadowsocks /bin/true +$ docker run --interactive --tty --rm --volumes-from shadowsocks-data leesah/shadowsocks vi /etc/shadowsocks/shadowsocks.json +``` + +Start the daemon container. + +```bash +$ docker run --name shadowsocks-app --detach --publish 58388:8388 --volumes-from shadowsocks-data leesah/shadowsocks +``` + +### Stop the daemon + +```bash +$ docker stop shadowsocks-app +``` + +### Start a stopped daemon + +```bash +$ docker start shadowsocks-app +``` + +### Upgrade + +COMING SOON + +### Use in CoreOS + +COMING SOON + +### Use with `fig` + +COMING SOON + +## References + +[Shadowsocks - Servers](http://shadowsocks.org/en/download/servers.html) diff --git a/docker/shadowsocks.json b/docker/shadowsocks.json new file mode 100644 index 0000000..c0bc7cc --- /dev/null +++ b/docker/shadowsocks.json @@ -0,0 +1,5 @@ +{ + "password":"Change Me!", + "timeout":120, + "method":"aes-256-cfb" +}