You can configure Docker to use a proxy server with the following steps:
1. Create a systemd drop-in directory for the Docker service:
```
$ sudo mkdir -p /etc/systemd/system/docker.service.d
```
1. Create a new file called `/etc/systemd/system/docker.service.d/http-proxy.conf` that adds the `HTTP_PROXY` environment variable:
```
$ sudo nano /etc/systemd/system/docker.service.d/http-proxy.conf
```
In the text file that opens, add the following:
```
[Service]
Environment=“HTTP_PROXY=http://proxy.example.com:80/“
```
Replace `http://proxy.example.com:80/` with the URL of your proxy server. If your proxy server requires a username and password, include them in the URL:
```
Environment=“HTTP_PROXY=http://username:password@proxy.example.com:80/“
```
1. If you have an HTTPS proxy server, create a version of the above configuration in a file named `/etc/systemd/system/docker.service.d/https-proxy.conf`:
```
$ sudo nano /etc/systemd/system/docker.service.d/https-proxy.conf
```
In this text file that opens, add the following:
```
[Service]
Environment=“HTTPS_PROXY=https://proxy.example.com:443/“
```
Replace `https://proxy.example.com:443/` with the URL of your HTTPS proxy server.
1. After creating the configuration files, flush changes and restart Docker with these commands:
```
$ sudo systemctl daemon-reload
$ sudo systemctl restart docker
```
1. Check that Docker is now using the proxy server with the following command:
```
$ systemctl show —property Environment docker
Environment=HTTP_PROXY=http://proxy.example.com:80/ HTTPS_PROXY=https://proxy.example.com:443/
```
If everything is configured correctly, the command should return the URLs of your proxy servers.
Keep in mind that these instructions will configure Docker to use these proxy servers for every new container. If you want to use proxy servers for specific containers, you should pass the `HTTP_PROXY` and `HTTPS_PROXY` environment variables to those containers using the `-e` option of the `docker run` command.