Настраиваем прокси сервер на платформе Docker

Настройка прокси сервера может потребоваться на платформе Docker в ряде случаев. Самыми распространёнными являются обход лимитов веб-провайдера и проведение тестов разработанного вами ПО во многих геолокациях. Начнём с рассмотрения понятия Докера.

Олександр Л.
Preview

Олександр Л.

12 June 2025

2134

2134

12 June 2025

What is Docker

Docker is a set of products implemented on the principle of "platform as a service" (PaaS), which use OS-level virtualization to deliver software in packages called containers, that is, to perform containerization of packages. The service offers different payment levels: free and premium with extended features. This software was released in 2013. In other words, Docker is a platform for developing, delivering, and running software, where you can separate your software from your infrastructure. Thus, a built container can be run on different operating systems. Additionally, you will be pleased to know that the Docker platform supports SSL, providing excellent security for information and networks when working with it, particularly during application testing. Containerized information contains:

  • The software itself, which needs to be launched by the developer;
  • The runtime environment — a virtual machine with a minimal set of necessary processes;
  • Files required to run the software;
  • The server.

StableProxy

Whether you need anonymous proxies, premium business solutions, or just want to buy cheap proxies — we have it all.


Setting up a proxy in Docker

There are 2 ways to configure: via command line and using a config file. Working in the command line looks like this:

  1. Since you'll use the parameter proxy.example.com:Port, you need to find out your proxy's IP address and the port you are using.
  2. In the command line, type the docker build command, which creates the config. You need to use the --build-arg argument. The full command will look like this:
    docker build --build-arg HTTP_PROXY="http://proxy.example.com:Port"
  3. Then, in the same command line, enter the docker run command to start the created configuration. You need to use the --env argument. The full command will look like this: docker run --env HTTP_PROXY="http://proxy.example.com:Port" redis Setting up Docker proxy using a config looks like this:
  4. In your working directory, find the folder .docker. Inside it should be a file named config.json. Create it if it does not exist.
  5. In the file, using your preferred code editor, enter the following lines:
{ 
"proxies": { 
"default": { 
"httpProxy": "http://proxy.example.com:Port", 
"httpsProxy": "https://proxy.example.com:Port", 
"ftpProxy": "https://proxy.example.com:Port", 
"noProxy": "*.test.example.com,.example.org,127.0.0.0/8" 
} 
} 
} 
  1. Replace proxy.example.com:Port with your actual IP address and port, as shown in the command line example.
  2. In the config file, as seen in the code above, you can use 4 proxy options:
  • HttpProxy — for the HTTP variant without encryption;
  • HttpsProxy — for the HTTPS variant with encryption;
  • FtpProxy — for FTP transfer of files;
  • noProxy — for directing direct traffic.
You should use similar proxy options when working with the command line, depending on your proxy type. After saving the config file, **docker proxy** will apply the information you provided to all new containers and to existing containers loaded from the Docker repository.

Frequently Asked Questions

Where to Buy Proxies in Ukraine?

The choice is obvious: stableproxy.com. We have an office and pay taxes in Ukraine. Our real servers are located on the territory of our country, ensuring you the highest quality and comfort.