Dockerfile-alpine
FROM alpine:3.13.1
RUN apk add --no-cache stunnel libressl openssl
COPY docker-entrypoint.sh /entrypoint.sh
VOLUME /etc/stunnel
ENTRYPOINT ["/entrypoint.sh"]
docker-entrypoint.sh
#!/bin/sh
cd /etc/stunnel
cat > stunnel.conf <<_EOF_
foreground = yes
setuid = stunnel
setgid = stunnel
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
cert = /etc/stunnel/stunnel.pem
client = ${CLIENT:-no}
[${SERVICE}]
accept = ${ACCEPT}
connect = ${CONNECT}
_EOF_
if ! [ -f stunnel.pem ]
then
openssl req -x509 -nodes -newkey rsa:2048 -days 3650 -subj '/CN=stunnel' \
-keyout stunnel.pem -out stunnel.pem
chmod 600 stunnel.pem
fi
exec stunnel "$@"
Service Run:
$ docker run -d --net host --name stunnel -e CLIENT=no -e SERVICE=sproxy -e ACCEPT=0.0.0.0:8788 -e CONNECT=10.140.0.2:8787 slzcc/stunnel:alpine
Client Run:
$ docker run -d --net host --name stunnel -e CLIENT=yes -e SERVICE=sproxy -e ACCEPT=0.0.0.0:8788 -e CONNECT=server:8788 slzcc/stunnel:alpine
不再推荐使用: Dockerfile-Centos
FROM centos:7.8.2003
RUN yum install -y stunnel openssl openssl-devel vim
CMD ["stunnel", "/etc/stunnel/stunnel.conf"]
Content type
Image
Digest
sha256:75b210780…
Size
292 MB
Last updated
about 4 years ago
docker pull slzcc/stunnel:centos