Running 3proxy as a Docker Proxy Server: A Simple Guide

In today’s interconnected world, proxy servers are essential tools for managing network traffic, enhancing security, and ensuring privacy. Docker simplifies the deployment and management of applications, and combining Docker with a proxy server like 3proxy creates a powerful and flexible solution. This article will guide you through using the tarampampam/3proxy Docker image to quickly set up and run your own proxy server.

[Insert Image 1 Here]

What is 3proxy?

3proxy is a lightweight yet robust proxy server capable of handling both HTTP and SOCKS proxy protocols. Known for its speed and efficiency, it’s an excellent choice for various proxy needs, from personal use to more demanding applications. The tarampampam/3proxy Docker image packages this powerful proxy server into a container, making deployment incredibly simple.

Why Choose a Docker Proxy Server?

Dockerizing your proxy server offers several advantages:

  • Isolation: Docker containers provide isolated environments, ensuring that your proxy server runs independently without interfering with other services on your system.
  • Simplicity: Docker streamlines the setup process. Forget about complex configurations and dependencies; with a single command, you can have a fully functional proxy server.
  • Scalability: Docker makes it easy to scale your proxy infrastructure. You can quickly spin up multiple proxy instances as your needs grow.
  • Portability: Docker containers are portable across different environments. Your proxy server setup will work consistently whether you’re on your local machine, in the cloud, or on-premises.
  • Version Control: Docker images are versioned, allowing you to easily roll back to previous proxy server configurations if needed.

Key Features of the 3proxy Docker Image

The tarampampam/3proxy Docker image is designed for ease of use and flexibility. Here are some of its standout features:

  • Multiple Architectures: Supports both amd64 and arm64 architectures, ensuring compatibility across a wide range of hardware.
  • Stable Version: Includes the stable version of 3proxy, providing a reliable and consistent proxy server experience.
  • Environment Variable Configuration: Configuration is primarily done through environment variables, making customization straightforward and integration with orchestration tools like Docker Compose and Kubernetes seamless.
  • Anonymous Proxy by Default: By default, the image is configured for anonymous proxy operation, hiding client information for enhanced privacy.
  • JSON Logging: Logs activity in JSON format, simplifying log analysis and integration with logging systems.
  • Pre-configured Ports: Exposes standard ports 3128 for HTTP proxy and 1080 for SOCKS proxy, ready for immediate use.
  • Helm Chart Available: For Kubernetes deployments, a Helm chart is available on ArtifactHUB, further simplifying deployment on container orchestration platforms.

[Insert Image 2 Here]

[Insert Image 3 Here]

Getting Started with Your Proxy Server Docker Container

Setting up your proxy server with Docker is incredibly simple. Here’s how to get started:

Basic Docker Run Command

To quickly launch a 3proxy Docker container with default settings, use the following command:

docker run --rm -d 
  -p "3128:3128/tcp" 
  -p "1080:1080/tcp" 
  ghcr.io/tarampampam/3proxy:1

This command does the following:

  • docker run --rm -d: Runs a Docker container in detached mode and automatically removes the container when it exits.
  • -p "3128:3128/tcp" -p "1080:1080/tcp": Maps ports 3128 and 1080 from the container to your host machine, allowing you to access the HTTP and SOCKS proxies on these ports respectively.
  • ghcr.io/tarampampam/3proxy:1: Specifies the Docker image to use from the GitHub Container Registry, using tag 1 for a stable version. You can also use tarampampam/3proxy from Docker Hub.

After running this command, your proxy server will be accessible on http://your_docker_host:3128 (HTTP) and socks5://your_docker_host:1080 (SOCKS).

Configuring Authentication and DNS

For more control, you can configure authentication and DNS resolvers using environment variables. Here’s an example:

docker run --rm -d 
  -p "3128:3128/tcp" 
  -p "1080:1080/tcp" 
  -e "PROXY_LOGIN=myusername" 
  -e "PROXY_PASSWORD=mypassword" 
  -e "PRIMARY_RESOLVER=2001:4860:4860::8888" 
  ghcr.io/tarampampam/3proxy:1

In this example:

  • -e "PROXY_LOGIN=myusername" -e "PROXY_PASSWORD=mypassword": Sets the username and password for proxy authentication. You’ll need to provide these credentials when connecting to the proxy.
  • -e "PRIMARY_RESOLVER=2001:4860:4860::8888": Configures a custom primary DNS resolver (in this case, a Google public IPv6 resolver).

Refer to the Supported Environment Variables table below for a full list of configurable options.

Docker Compose for Persistent Configuration

For more complex setups and persistent configurations, Docker Compose is an excellent choice. Create a docker-compose.yml file with the following content:

version: '3.8'
services:
  proxy:
    image: ghcr.io/tarampampam/3proxy:1
    environment:
      PROXY_LOGIN: myusername
      PROXY_PASSWORD: mypassword
      MAX_CONNECTIONS: 10000
      PROXY_PORT: 8000
      SOCKS_PORT: 8001
      PRIMARY_RESOLVER: 77.88.8.8
      SECONDARY_RESOLVER: 8.8.8.8
    ports:
      - '8000:8000/tcp'
      - '8001:8001/tcp'

Then, start your proxy server using Docker Compose:

docker-compose up -d

This Docker Compose configuration defines a service named proxy using the ghcr.io/tarampampam/3proxy:1 image and sets various environment variables for customization, including custom ports and increased maximum connections.

Supported Environment Variables for Proxy Server Docker

The tarampampam/3proxy Docker image offers extensive customization through environment variables:

Variable Name Description Example
PROXY_LOGIN Authorization login (empty by default) username
PROXY_PASSWORD Authorization password (empty by default) password
EXTRA_ACCOUNTS Additional proxy users (JSON object format) {"evil":"live", "guest":"pass"}
PRIMARY_RESOLVER Primary DNS resolver (1.0.0.1 by default) 8.8.8.8:5353/tcp
SECONDARY_RESOLVER Secondary DNS resolver (8.8.4.4 by default) 2001:4860:4860::8844
MAX_CONNECTIONS Maximum number of connections (1024 by default) 2056
PROXY_PORT HTTP proxy port (3128 by default) 8080
SOCKS_PORT SOCKS proxy port (1080 by default) 8888
EXTRA_CONFIG Additional 3proxy configuration (appended to the end of the config file) # line 1n# line 2
LOG_OUTPUT Path for log output (/dev/stdout by default; set to /dev/null to disable logging) /tmp/3proxy.log

Docker Image Tags

It is highly recommended to use specific version tags (e.g., 1.8.2) instead of latest to ensure stability and avoid unexpected breaking changes from major updates. You can find a list of all available tags on Docker Hub.

[Insert Image 4 Here]

[Insert Image 5 Here]

Kubernetes Deployment with Helm Chart

For deploying your proxy server on Kubernetes, the proxy-3proxy Helm chart simplifies the process. You can find it on ArtifactHUB. Helm charts streamline Kubernetes application deployment and management, making it easier to operate 3proxy in a clustered environment.

Conclusion

The tarampampam/3proxy Docker image provides a straightforward and efficient way to run a proxy server using Docker. Its ease of configuration, combined with the power of 3proxy, makes it an excellent choice for various proxy server needs. Whether you need a simple proxy for personal use or a robust solution for your applications, this Docker image offers a flexible and reliable platform. Start using it today and experience the benefits of a containerized proxy server.

[Insert Image 6 Here]

For more information and to contribute to the project, visit the GitHub repository.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *