Create a Privoxy + Tor environment instantly using Docker

Introduction

Docker makes it easy to set up a Privoxy + Tor environment. Basically, you can understand it by reading the official page below, but since I realized the convenience of Docker, I will write it as an article.

dperson/torproxy

This time, I used the image of dperson / torproxy, but you can find some images of Privoxy + Tor by searching. I haven't tried anything else, but I think it's possible to do the same with any of the simple requirements I'll show you here.

Why use Privoxy + Tor

In Linux, just install Tor and start it, and with the default settings, a SOCKS5 proxy will start up on port 9050 of the local host, and you can use that proxy to access the Web via Tor. However, although access by curl etc. is good, in some cases HTTP proxy can be used but SOCKS proxy cannot be used directly. In that case, Privoxy and Tor will be used in combination. With proper settings, you can access the flow like Privoxy → Tor → website via HTTP proxy by Privoxy (port 8118 by default). The specific setting method is introduced on the following page, for example.

4.10. How do I use Privoxy together with Tor?

This is fine, but installing Privoxy and rewriting the config file is a hassle. It's also a bit unpleasant for Privoxy to remain local. You can solve those problems by launching the environment with Docker.

docker command

Start-up

Start the Privoxy + Tor container with a command similar to the following:

docker run -it -p 8118:8118 -p 9050:9050 -d dperson/torproxy

-p 8118: 8118 specifies the port binding. Notation like -p host side port: container side port. Therefore, if the host port 8118 is already in use

docker run -it -p 8119:8118 -p 9050:9050 -d dperson/torproxy

It is okay if you change the port number to one that is not used. Also, -p 9050: 9050 is a port for connecting to Tor's SOCKS proxy, so if you only need an HTTP proxy,

docker run -it -p 8118:8118 -d dperson/torproxy

If you omit the setting of port 9050 as in, only the HTTP proxy will start in a state where it can be accessed from the host.

Operation check

Check the operation with curl.

curl -L ipinfo.io

If you access ipinfo.io with curl like this, the IP of the connection source etc. will be displayed. If you don't set any proxy, you should see your home IP address.

Start the container with the command docker run -it -p 8118: 8118 -p 9050: 9050 -d dperson / torproxy, and if you can access the Privoxy HTTP proxy on port 8118, use the following command via the proxy Web access for.

curl -Lx localhost:8118 ipinfo.io

(Specify the proxy with the -x option) If the container is started and you can access it through the proxy correctly, you should see an IP address different from your home one.

Check the SOCKS proxy as well.

curl -Lx socks5h://localhost:9050 ipinfo.io

You should be able to confirm that you are accessing via Tor with this command.

finish

Check the container that is up with the following command.

$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                 PORTS                                                      NAMES
ae9565085d51        dperson/torproxy    "/sbin/tini -- /usr/…"   8 hours ago         Up 8 hours (healthy)   0.0.0.0:8118->8118/tcp, 9050/tcp, 0.0.0.0:9050->9050/tcp   inspiring_brahmagupta

Check the CONTAINER ID or NAMES here and use it as an argument for the following command.

docker stop ae9565085d51

Specify CONTAINER ID or NAMES in the argument of docker stop. This will stop the container.

Recommended Posts

Create a Privoxy + Tor environment instantly using Docker
Create a web environment quickly using Docker
Create a Vue3 environment with Docker!
Create a MySQL environment with Docker from 0-> 1
[Memo] Create a CentOS 8 environment easily with Docker
Create a docker environment for Oracle 11g XE
Create a Spring Boot development environment with docker
[Note] Create a java environment from scratch with docker
Try to build a Java development environment using Docker
[2021] Build a Docker + Vagrant environment for using React / TypeScript
[Docker] Create Elasticsearch, Kibana environment!
Create a fortune using Ruby
I tried to create a padrino development environment with Docker
[Android] Create a calendar using GridView
Create a Jetty project using Eclipse
Build a Node.js environment with Docker
Create a lightweight STNS Docker image
Create a tomcat project using Eclipse
Create a database in a production environment
Create SolrCloud verification environment with Docker
Create a Java project using Eclipse
Create a filtering function using acts-as-taggable-on
Create Laravel environment with Docker (docker-compose)
Build a browser test environment using Capybara in the Docker development environment
Set up a Wordpress Docker environment without using the Worpdress image
Let's install Docker on Windows 10 and create a verification environment for CentOS 8!
How to build a Ruby on Rails environment using Docker (for Docker beginners)
Build a PureScript development environment with Docker
Create Rails 6 + MySQL environment with Docker compose
Building a Kotlin development environment using SDKMAN
Build a WAS execution environment from Docker
Try to create a browser automatic operation environment using Selenide in 5 minutes
Create Spring Boot-gradle-mysql development environment with Docker
Let's create a Java development environment (updating)
[Docker] Create Node.js + express + webpack environment with Docker
[Docker] How to create a virtual environment for Rails and Nuxt.js apps
Create a RESTful API service using Grape
Build a Wordpress development environment with Docker
Docker Compact Manual (4: Create a custom image)
Create a java web application development environment with docker for mac part2
I made a bulletin board using Docker 1
Install Docker and create Java runtime environment
Create a prefectural select bar using active_hash
Create a login function using Swift's Optional
Build a simple Docker + Django development environment
[First environment construction] I tried to create a Rails 6 + MySQL 8.0 + Docker environment on Windows 10.
Build a development environment to create Ruby on Jets + React apps with Docker
Build a development environment for Docker + Rails6 + Postgresql
[Android] Create a sliding menu without using NavigationView
Let's create a REST API using WildFly Swarm.
[Windows] [IntelliJ] [Java] [Tomcat] Create a Tomcat9 environment with IntelliJ
[Rails] How to create a graph using lazy_high_charts
Build a Laravel / Docker environment with VSCode devcontainer
Building a CICD pipeline using Docker (personal memorandum)
Build a WordPress development environment quickly with Docker
Kaggle environment construction using official Docker and vscode
Build a Kotlin app using OpenJDK's Docker container
Create a Spring Boot application using IntelliJ IDEA
INTERNAL ERROR: cannot create temporary directory !: Docker environment
Build a simple Docker Compose + Django development environment
Prepare a scraping environment with Docker and Java