Configure Docker to Use Proxy Server
If you have employed a proxy server on your servers, you must configure Docker on the application and database servers to enable the containers to use the HTTP or HTTPS proxy servers.
To configure Docker to use a proxy server, follow these steps:
To retrieve the location of the
docker.servicefile in a server, sign in to the server and run the following command:systemctl status docker
Note
The default location of the
docker.servicefile is/usr/lib/systemd/system/docker.service.To open the
docker.servicefile in edit mode, run the following command:vi /usr/lib/systemd/system/docker.service
Add the proxy server URLs and save the
docker.servicefile. For example:[Service] Environment="HTTP_PROXY=http://proxy.example.com:80" Environment="HTTPS_PROXY=https://proxy.example.com:80" Environment="NO_PROXY=localhost,127.0.0.1,docker-registry.example.com,.corp"
To restart system daemon and Docker, run the following commands:
systemctl daemon-reload systemctl restart docker
After system daemon and Docker restart, run the systemctl status docker command to verify if Docker is up and running. Similarly, configure Docker on all servers to use the proxy.
Update Application Configuration
Update the tenant.env file to update the configuration of the application server to use a proxy.
To update the tenant.env file, follow these steps:
Sign in to the application server and go to the directory of the
tenant.envfile. The default directory of thetenant.envfile is/apps/cyware/conf/.To open the
tenant.envfile in edit mode, run the following command:vi tenant.env
Make changes to http and https_proxy with the new proxy. You can also add if new proxy IP addresses are to be allowed on the proxy allowed variable.
Save the
tenant.envfile.To restart system daemon and Docker, run the following commands:
systemctl daemon-reload systemctl restart docker
After system daemon and Docker restart, verify if the configured proxy is working. You can export the http_proxy and https_proxy, and run
curl -v https://prod.packages.cyware.com/or any other allowed URL.After the configured proxy is verified, go to the
/apps/cyware/directory and run the.shfiles to activate the application and database stack. For example, run the following commands:bash app.sh bash setup_db.sh
To verify if all the services are up and running, run the following command :
docker ps
If all Docker services are up and running, then Docker is successfully configured to use the proxy.