创建Dockerfile
FROM centos:7.9.2009
RUN yum -y install gcc gcc-c++ automake make pam-devel openldap-devel cyrus-sasl-devel openssl-devel wget telnet net-tools
RUN wget http://jaist.dl.sourceforge.net/project/ss5/ss5/3.8.9-8/ss5-3.8.9-8.tar.gz
RUN tar -zxvf ss5-3.8.9-8.tar.gz && cd ss5-3.8.9 && ./configure && make && make install
EXPOSE 1080
WORKDIR /
# 基于centos:7.9.2009创建的容器中执行/etc/init.d/ss5时,需要network,默认是没有的, 所以创建一个空文件
RUN touch /etc/sysconfig/network
RUN chmod +x /etc/init.d/ss5
构建
docker build -t socks5 .
创建docker-compose.yml
version: '3.3'
services:
socks5:
image: socks5
container_name: socks5
restart: always
ports:
- 16688:1080
entrypoint: [ "bash", "-c", "/usr/sbin/ss5 && tail -100f /var/log/ss5/ss5.log"]
volumes:
- ./ss5.conf:/etc/opt/ss5/ss5.conf:ro
- ./ss5.passwd:/etc/opt/ss5/ss5.passwd:ro
启动ss5容器
docker-compose up -d