Docker the use of Dockerfile to create shadowsocks multiple-user version of the image, to achieve rapid cluster deployment

Source: Internet
Author: User
Tags gpg md5 centos iptables git clone docker ps docker run

Mirror capture
[Root@docker-node01 ~]# Docker Search Shadowsocksr_manyuser
NAME DESCRIPTION Stars Official automated
Benyoo/shadowsocksr_manyuser based on SHADOWSOCKSR version of Manyuser package 0
[Root@docker-node01 ~]# docker run-d--name=shadowsocks \
-P 10000-10010:10000-10010 \
-P 10000-10010:10000-10010/UDP \
-E manyuser=r \
-E mysql_host=1.2.3.4 \
-E mysql_port=3306 \
-E mysql_user=mysqlroot \
-E mysql_dbname=shadowsocks \
-E mysql_password=********* \
-E method=rc4-md5 \
-E protocol=auth_simple \
-E obfs=http_simple_compatible \
-E obfs_param= "youku.com" \
Benyoo/shadowsocksr_manyuser:latest
67d941fa8c96bc44a5fd5e3e49776928d66e45c58705f056500dd9f88caf3931
[Root@docker-node01 ~]# Docker Ps-a
CONTAINER id        image                                   command                created             STATUS               ports                                                                                              NAMES
67d941fa8c96 benyoo/shadowsocksr_manyuser:latest "/run.sh server.py" 7 seconds ago up 4 seconds 0. 0.0.0:10000-10010->10000-10010/tcp, 0.0.0.0:10000-10010->10000-10010/UDP, 10011-20000/tcp ShadowSocks

Mirroring usage Instructions




















































Variable name Default Parameters Description
Manyuser Available parameters are: r| On
When the parameter is R, the multiuser version of the SHADOWSOCKSR mode is used.
Otherwise use Shadowsocks in the original version of the multi-user mode.
Mysql_host When the Manyuser variable has parameters, it is enabled.
Database address
Mysql_port When the Manyuser variable has parameters, it is enabled.
Database port
Mysql_user When the Manyuser variable has parameters, it is enabled.
Database user Name
Mysql_dbname When the Manyuser variable has parameters, it is enabled.
Database Library Name
Mysql_password When the Manyuser variable has parameters, it is enabled.
Database Password
Method Aes-256-cfb Available options are:
Aes-256-cfb|aes-192-cfb|aes-128-cfb|chacha20|salsa20|rc4-md5
PROTOCOL Origin Available parameters are:
Origin|verify_simple|verify_deflate|auth_simple
Obfs Http_simple_compatible Available parameters are:
Plain|http_simple|http_simple_compatible
|tls_simple|tls_simple_compatible|random_head
|random_head_compatible
Obfs_param
Dns_ipv6 False Available parameters are: false|true

from centos:6.7 maintainer from www.dwhd.org to Lookback (mondeolove@gmail.com) RUN yum Clean all &&am P \ rpm--import/etc/pki/rpm-gpg/rpm-gpg-key-centos-* && \ Yum install-y m2crypto python-setuptools git curl Les-devel && \ easy_install pip && pip install cymysql RUN git clone-b manyuser https://github.com/break Wa11/shadowsocks.git #RUN git clone-b manyuser https://github.com/mengskysama/shadowsocks.git ADD run.sh/run.sh RUN CHM OD +x/run.sh expose 10000-20000 entrypoint ["/run.sh"] CMD ["server.py"] 
#!/bin/sh ######################################################################### # File Name:run.sh # Author: Lookback # email:admin#dwhd.org # Version: # Created time:2015 Year November 18 Wednesday 02:49 12 seconds #################################### ##################################### Path=/bin:/sbin: $PATH set-e if ["${1:0:1}" = '-']; Then set-Python "$@" fi if [-N "$MANYUSER"]; Then if [-Z "$MYSQL _password"];  Then echo >&2 ' error:missing Mysql_password ' echo >&2 ' Did you forget to                 Add-e mysql_password= ...? Exit 1 fi if [-Z "$MYSQL _user"];  Then echo >&2 ' error:missing mysql_user ' echo >&2 ' Did you forget to add                 -E mysql_user= ...? Exit 1 fi if [-Z "$MYSQL _port"];  Then echo >&2 ' error:missing mysql_port ' echo >&2 ' Did you forget to add -E mysql_port= ...?' Exit 1 fi if [-Z "$MYSQL _host"];  Then echo >&2 ' error:missing mysql_host ' echo >&2 ' Did you forget to add                 -E mysql_host= ...? Exit 1 fi if [-Z "$MYSQL _dbname"]; Then echo >&2 ' error:missing mysql_dbname ' echo >&2 ' Did you forget to a                 Dd-e mysql_dbname= ...? Exit 1 fi for I $MYSQL _user $MYSQL _port $MYSQL _host $MYSQL _dbname $MYSQL _password; Do if grep ' @ ' <<< ' $i ' >/dev/null 2>&1; Then echo >&2 "Error:missing-e $i" echo >&2 "you can" t  Special characters ' @ ' "Exit 1 fi done Sed-ri" s@^ (mysql_host =        ). *@\1 ' $MYSQL _host ' @ "/shadowsocks/config.py Sed-ri" s@^ (Mysql_port =). *@\1$mysql_port@ "/shadowsocks/config.py  Sed-ri "s@^ (Mysql_user =). *@\1 ' $MYSQL _user ' @"/shadowsocks/config.py Sed-ri "s@^ (Mysql_pass =). *@\1 ' $MYSQL _p         Assword ' @ "/shadowsocks/config.py Sed-ri" s@^ (mysql_db =). *@\1 ' $MYSQL _dbname ' @ '/shadowsocks/config.py else         echo >&2 ' error:missing manyuser ' echo >&2 ' Did you forget to Add-e manyuser= ...? ' Exit 1 fi if ["$MANYUSER" = "R"]; Then if [-Z "$PROTOCOL"]; Then echo >&2 ' error:missing PROTOCOL ' echo >&2 ' Did you forget to add-                 E protocol= ...? Exit 1 elif [[!] "$PROTOCOL" =~ ^ (origin|verify_simple|verify_deflate|auth_simple) $]]; Then echo >&2 ' error:missing PROTOCOL ' echo >&2 ' You must to be used-e PRO Tocol=[origin|verify_simple|verify_deflate|auth_simple] ' exit 1 fi if [-Z ' $OBFS];        Then echo >&2 ' error:missing obfs '         echo >&2 ' Did you forget to Add-e obfs= ...? ' Exit 1 elif [[!] "$OBFS" =~ ^ (plain|http_simple|http_simple_compatible|tls_simple|tls_simple_compatible|random_head|random_head_ compatible) $]]; Then echo >&2 ' error:missing obfs ' echo >&2 ' You must be USED-E obfs=[h                 Ttp_simple|plain|http_simple_compatible|tls_simple|tls_simple_compatible|random_head|random_head_compatible] ' Exit 1 fi if [-Z "$OBFS _param"];  Then echo >&2 ' error:missing obfs_param ' echo >&2 ' Did you forget to add                 -E obfs_param= ...? Exit 1 fi if [-N "$METHOD"]; Then if [[!] "$METHOD" =~ ^ (aes-(256|192|128)-cfb| ( CHACHA|SALSA) 20|RC4-MD5) $]]; Then echo >&2 ' Error:missing method ' echo >&2 ' for you must Be used-e method=[aes-256-cfb|aes-192-CFB|AES-128-CFB|CHACHA20|SALSA20|RC4-MD5] ' exit 1 else sed -ri "s@^ (. *\" method\ ":). *@\1\" $METHOD \ ", @"/shadowsocks/config.json fi fi If [-N "$DNS _ipv6 "]; Then if [[!] "$DNS _ipv6" =~ ^ (false|true) $]]; Then echo >&2 ' error:missing Dns_ipv6 ' echo >&2 ' you mus t be used-e dns_ipv6=[false|true] ' exit 1 else Sed-ri ' s @^ (. *\ "dns_ipv6\":). *@\1\ "$DNS _ipv6\", @ "/shadowsocks/config.json fi fi Sed-ri" s@^ (. *\ "Protocol\":). *@\1\ "$PROTOCOL \", @ "/shadowsocks/config.json Sed-ri" s@^ (. *\ "Obfs\":). *@\1\ "$OBFS \", @ "/shadowso Cks/config.json Sed-ri "s@^ (. *\" obfs_param\ ":). *@\1\" $OBFS _param\ ", @"/shadowsocks/config.json fi if [-N "$SP AM "]; Then if ["$SPAM" = "on"]; Then iptables-T mangle-a output-m string--string "Subject"--algo BM--to 65535-j DROP iptables-t mangle-a OUTPUT -M string--string "HELO"--algo BM--to 65535-j DROP iptables-t mangle-a output-m string--string "S  MTP "--algo BM--to 65535-j DROP iptables-t mangle-a output-m string--string" torrent "--algo BM--to                 65535-j drop iptables-t mangle-a output-m string--string ". Torrent"--algo BM--to 65535-j Drop Iptables-t mangle-a output-m string--string "peer_id="--algo BM--to 65535-j DROP Iptab Les-t mangle-a output-m string--string "announce"--algo BM--to 65535-j DROP iptables-t mangle-a O Utput-m string--string "Info_hash"--algo BM--to 65535-j DROP iptables-t mangle-a output-m string- -string "Get_peers"--algo BM--to 65535-j DROP iptables-t mangle-a output-m string--string "Find_nod E "--algo BM--to 65535-j drop iptables-t mangle-a output-m string--string "BitTorrent"--algo BM--to 65535-j DROP Iptables-t mangle-a output-m string--string "Announce_peer"--algo BM--to 65535-j DROP Iptab  Les-t mangle-a output-m string--string "BitTorrent"--algo BM--to 65535-j DROP iptables-t mangle-a Output-m string--string "protocol"--algo BM--to 65535-j DROP iptables-t mangle-a output-m string --string "announce.php?passkey="--algo BM--to 65535-j DROP iptables-t filter-a output-p tcp-m Port--dports 25,26,465-m State--state new,established-j REJECT--reject-with icmp-port-unreachable IPT Ables-t filter-a output-p tcp-m multiport--dports 109,110,995-m State--state new,established-j REJECT  H icmp-port-unreachable iptables-t filter-a output-p tcp-m multiport--dports State --state new,established -j REJECT--reject-with icmp-port-unreachable iptables-t filter-a output-p tcp-m multiport--dports 2 4,50,57,105,106,158,209,587,1109,24554,60177,60179-m State--state New,established-j REJECT--reject-with         Icmp-port-unreachable iptables-t mangle-l-nvx--lin iptables-t filter-l-nvx--lin Fi else echo >&2 ' error:missing SPAM ' echo >&2 ' You must be USED-E spam=[on| Off] ' fi exec python/shadowsocks/server.py

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.