DEV Community

Boris Quiroz
Boris Quiroz

Posted on

Running tor using docker

If you want to connect to tor network without using tor browser, docker is the solution!

Just copy this code into a Dockerfile:

FROM alpine:edge

RUN apk update
RUN apk add tor

RUN echo "Log notice stdout" >> /etc/torrc
RUN echo "SocksPort 0.0.0.0:9150" >> /etc/torrc

EXPOSE 9150

CMD tor -f /etc/torrc
Enter fullscreen mode Exit fullscreen mode

Build it with docker build -t tor -f Dockerfile . and run it with:

docker run -d --rm --name tor -p 9150:9150 tor
Enter fullscreen mode Exit fullscreen mode

But, if you don't want to do the build just run:

docker run -d --rm --name tor -p 9150:9150 boris/tor:alpine
Enter fullscreen mode Exit fullscreen mode

After that, you'll have a tor proxy running in your 127.0.0.1:9150 so go ahead and configure your browser of choice to use a SOCKS proxy on 127.0.0.1:9150 and you'll go from this:

To this:

Enjoy your privacy :)

PS: Code for my Dockerfile is here and the image in Docker hub is here

Top comments (0)