# Tor Socks Proxy and Privoxy Containers

DevFeed: [Tor Socks Proxy and Privoxy Containers](<https://devfeed.tech/articles/tor-socks-proxy-and-privoxy-containers-35212.md>)

Original publisher: [Read original article](<https://blog.jessfraz.com/post/tor-socks-proxy-and-privoxy-containers/>)

Published: 2015-09-12T18:47:47Z

Content type: tutorial

Language: en

Sources: [Jessie Frazelle](<https://devfeed.tech/sources/jessie-frazelle.md>)

Topics: [Containers](<https://devfeed.tech/topics/containers.md>), [Docker](<https://devfeed.tech/topics/docker.md>), [proxy](<https://devfeed.tech/topics/proxy.md>), [HTTP](<https://devfeed.tech/topics/http.md>), [Dockerfile](<https://devfeed.tech/topics/dockerfile.md>), [Docker Image](<https://devfeed.tech/topics/docker-image.md>), [Docker Container](<https://devfeed.tech/topics/docker-container.md>), [Docker Hub](<https://devfeed.tech/topics/docker-hub.md>)

Tags: [containers](<https://devfeed.tech/tags/containers.md>), [docker](<https://devfeed.tech/tags/docker.md>), [docker-container](<https://devfeed.tech/tags/docker-container.md>), [docker-hub](<https://devfeed.tech/tags/docker-hub.md>), [docker-image](<https://devfeed.tech/tags/docker-image.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [http](<https://devfeed.tech/tags/http.md>), [proxy](<https://devfeed.tech/tags/proxy.md>)

## AI overview

A tutorial showing how to build and run Docker containers for a Tor SOCKS5 proxy and a separate Privoxy HTTP proxy. It covers the Dockerfiles, relevant configuration changes, container networking, port publishing, and testing proxy traffic with curl.

## Source excerpt

Okay so this is part 2.5 in my series of posts combining my two favorite things, Docker & Tor. If you are just starting here, to catch you up, the first post was "How to Route all Traffic through a Tor Docker container". The second was on "Running a Tor relay with Docker". I thought it only made sense to show how to set up a Tor socks5 proxy in a container, for routing some traffic through Tor; in contrast to the first post, where I explained how to route all your traffic. Tor Socks5 Proxy I have made a Docker image for this which lives at jess/tor-proxy on the Docker hub. But I will go over the details so you can build one yourself. The Dockerfile looks like the following: FROM alpine:latest # Note: Tor is only in testing repo -> http://pkgs.alpinelinux.org/packages?package=emacs&repo=all&arch=x86_64 RUN apk update && apk add \ tor \ --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ \ && rm -rf /var/cache/apk/* # expose socks port EXPOSE 9050 # copy in our torrc file COPY torrc.default /etc/tor/torrc.default # make sure files are owned by tor user RUN chown -R tor /etc/tor USER tor ENTRYPOINT [ "tor" ] CMD [ "-f", "/etc/tor/torrc.default" ] Which looks a lot like the Dockerfile for a relay, if you recall. But the key difference is the torrc. Now the only thing I have changed from the default torrc is the following line: SocksPort 0.0.0.0:9050 This is so that it can bind correctly to the network namespace the container is using. This image weighs in at only 11.51 MB! To run the image: $ docker run -d \ --restart always \ -v /etc/localtime:/etc/localtime:ro \ # i like this for all my containers, but it's optional -p 9050:9050 \ # publish the port --name torproxy \ jess/tor-proxy Okay, awesome, now you have the socks5 proxy running on port 9050. Let's test it: # get your current ip $ curl -L http://ifconfig.me # get your ip through the tor socks proxy $ curl --socks http://localhost:9050 -L http://ifconfig.me # obviously they should be diffe