DEV Community

Boris Quiroz
Boris Quiroz

Posted on

3 1

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

Billboard image

Deploy and scale your apps on AWS and GCP with a world class developer experience

Coherence makes it easy to set up and maintain cloud infrastructure. Harness the extensibility, compliance and cost efficiency of the cloud.

Learn more

Top comments (1)

Collapse
 
codedude64 profile image
codeDude64

Thanks for the post it's helpful. Just a question for my curiosity Why did you use port 9150?

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay