📅  最后修改于: 2023-12-03 15:30:32.122000             🧑  作者: Mango
If you're a programmer using Docker on Windows 7, you may run into issues with connectivity due to proxy settings. This guide will help you navigate those issues and set up Docker Toolbox to work with a proxy.
Docker Toolbox is a legacy version of Docker for Windows 7 and earlier versions. It includes VirtualBox, which runs a Linux virtual machine (VM) to host Docker containers. If you're behind a proxy, you may have trouble connecting to the internet from the VM, which will prevent you from pulling images or accessing external resources.
To make VirtualBox work with a proxy, you need to configure its network settings. Go to the VirtualBox Manager and click on your Docker VM. Then click the "Settings" button.
From there, go to the "Network" tab and select "Adapter 1". In the "Attached to" field, select "Bridged Adapter". Then click the "Advanced" dropdown and select "Adapter Type" as "PCnet-FAST III". Finally, scroll down to the "Adapter Type" dropdown and select "Intel PRO/1000 MT Desktop (82540EM)".
Click "OK" to save the changes.
Open up the Docker Quickstart Terminal from your Start Menu. This will open a command prompt with the environment variables needed for Docker Toolbox to run.
In the terminal, run the following commands to set the proxy environment variables:
$ export http_proxy=http://your.proxy.server:port
$ export https_proxy=https://your.proxy.server:port
$ export no_proxy=localhost,127.0.0.1,192.168.99.100
Be sure to replace "your.proxy.server" and "port" with your specific proxy server and port number. Additionally, you may need to add other hostnames or IP addresses to the "no_proxy" list if your application requires it.
To apply the changes, you need to restart the Docker VM. In the Docker Quickstart Terminal, run the following command:
$ docker-machine restart
This will stop and start the Docker VM with the updated network settings and proxy environment variables.
By following these steps, you should now be able to use Docker Toolbox with a proxy on Windows 7. Remember to set the proxy environment variables each time you open the Docker Quickstart Terminal, as they are not persistent across sessions.