安装docker

# 首先更新一下:
yum -y update

# centos8默认使用podman代替docker,所以需要containerd.io,那我们就安装一下就好了

yum install https://download.docker.com/linux/fedora/30/x86_64/stable/Packages/containerd.io-1.2.6-3.3.fc30.x86_64.rpm

# 安装一些其他依赖
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

# 安装docker
yum install -y docker-ce

# 启动docker
systemctl start docker

vim新建dockerfile文件

# shadowsocksr
#
# VERSION 0.0.3

FROM ubuntu:16.04
MAINTAINER haha@gmail.com

RUN apt-get update && \
    apt-get install -y python-pip libsodium18
RUN apt-get install -y git
RUN git clone https://github.com/ToyoDAdoubiBackup/shadowsocksr.git
RUN cd /shadowsocksr
RUN chmod +x /shadowsocksr/*.sh && chmod +x /shadowsocksr/shadowsocks/*.sh
RUN cp -n /shadowsocksr/apiconfig.py /shadowsocksr/userapiconfig.py && cp -n /shadowsocksr/config.json /shadowsocksr/user-config.json && cp -n /shadowsocksr/mysql.json /shadowsocksr/usermysql.json
RUN cd /shadowsocksr/shadowsocks
# Configure container to run as an executable
ENTRYPOINT ["/usr/bin/python","/shadowsocksr/shadowsocks/server.py"]

构建和运行

# 构建
docker build -t ssr .

# 使用ssr镜像运行
docker run -d -p 443:443 --name ssr ssr -p 443 -k your_passwd -m aes-128-cfb -O auth_aes128_md5 -o tls1.2_ticket_auth_compatible