Last active
April 6, 2022 03:06
-
-
Save hazcod/ccbadddd1843569d1a94f660a9f6e542 to your computer and use it in GitHub Desktop.
Expose docker.sock on a TCP socket.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine | |
# the group id of the docker group on the host | |
ENV HOST_DOCKER_GID 101 | |
# SECURITY CONSIDERATIONS: | |
# Only expose this via a dedicated internal, encrypted net to your webserver/.. | |
# Mount /var/run/docker.sock READONLY, make this container readonly too | |
RUN addgroup -g $HOST_DOCKER_GID docker \ | |
&& adduser -H -D -G docker -s /bin/true socat | |
RUN apk add -U socat \ | |
&& rm -rf /var/cache/apk* | |
USER socat | |
EXPOSE 9090 | |
CMD /usr/bin/socat -d -d TCP-L:9090,fork UNIX:/var/run/docker.sock |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment