Skip to main content

General Documents

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:

  1. To retrieve the location of the docker.service file in a server, sign in to the server and run the following command:

     systemctl status docker

    Note

    The default location of the docker.service file is /usr/lib/systemd/system/docker.service.

  2. To open the docker.service file in edit mode, run the following command:

     vi /usr/lib/systemd/system/docker.service
  3. Add the proxy server URLs and save the docker.service file. 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" 
  4. 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:

  1. Sign in to the application server and go to the directory of the tenant.env file. The default directory of the tenant.env file is /apps/cyware/conf/.

  2. To open the tenant.env file in edit mode, run the following command:

    vi tenant.env
  3. 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.

  4. Save the tenant.env file.

  5. To restart system daemon and Docker, run the following commands:

    systemctl daemon-reload
    systemctl restart docker
  6. 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.

  7. After the configured proxy is verified, go to the /apps/cyware/ directory and run the .sh files to activate the application and database stack. For example, run the following commands:

    bash app.sh 
    bash setup_db.sh
  8. 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.