Dockerize Shadowsocks
- Dockerfile: builds a Shadowsocks image - shadowsocks.json default config file - README.md: describing the usage of the image
This commit is contained in:
parent
8be120518b
commit
23b6a24bba
3 changed files with 107 additions and 0 deletions
38
docker/Dockerfile
Normal file
38
docker/Dockerfile
Normal file
|
@ -0,0 +1,38 @@
|
|||
FROM ubuntu:latest
|
||||
|
||||
MAINTAINER Sah Lee <contact@leesah.name>
|
||||
|
||||
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
|
64
docker/README.md
Normal file
64
docker/README.md
Normal file
|
@ -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)
|
5
docker/shadowsocks.json
Normal file
5
docker/shadowsocks.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"password":"Change Me!",
|
||||
"timeout":120,
|
||||
"method":"aes-256-cfb"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue