# Set up a proxied environment (HTTP proxy available)

Follow the procedure below to configure Datalore to use a proxy server in a restricted environment.

Procedure: Set up a proxied environment

1. Rebuild the `datalore-database-command` image.

Configure an HTTPS proxy server in the SQL runtime container using JVM options. See the example below.

> **Note:**
> Make sure you set your `-Dhttps.proxyHost` and `-Dhttps.proxyPort` command line arguments in the `init_database_env.sh` file accordingly.

`Dockerfile`

```DOCKERFILE
FROM jetbrains/datalore-database-command:2026.3
COPY init_databases_env.sh /opt/datalore/init_databases_env.sh
```

`init_database_env.sh`

```BASH
#!/bin/bash
set -ex

export DATALORE_HOME=/opt/datalore
databases_lib_target_dir=$DATALORE_HOME/databases_lib_dir

datagrip_driver_dir=$DATALORE_HOME/datagrip.driver.path

MAX_HEAP_SIZE=${MAX_HEAP_SIZE:-512m}
source setenv.sh

export DATABASES_JAVA_OPTS="$MEMORY_JAVA_OPTS ${JIGSAW_JAVA_OPTS[*]} \
-Dhttps.proxyHost=IP_ADDR_OF_YOUR_PROXY -Dhttps.proxyPort=PORT_OF_YOUR_PROXY \
-Djava.util.logging.config.file=${DATALORE_HOME}/logging.properties \
-Dlogback.configurationFile=${DATALORE_HOME}/logback.xml \
-Didea.home.path=${databases_lib_target_dir} \
-Ddatagrip.driver.path=${datagrip_driver_dir} \
-Ddatagrip.disable.artifact.updates=true \
-Dathena.aws.credentials.provider.jar.path=athena-aws-credentials-provider.jar \
-Dathena3.aws.credentials.provider.jar.path=athena3_deploy.jar \
-cp ${databases_lib_target_dir}/* \
"
```

2. Rebuild the `datalore-agent` image.

Configure an HTTP/HTTPS proxy server in the computational agent container using environment variables and JVM options. See the example below.

> **Note:**
> Make sure you set your `PROXY_HOST` and `PROXY_PORT` variables in the `on_agent_start.sh` file accordingly.

`Dockerfile`

```DOCKERFILE
FROM jetbrains/datalore-agent:2026.3
COPY on_agent_start.sh /opt/datalore/on_agent_start.sh
```

`on_agent_start.sh`

```BASH
PROXY_HOST="your proxy host"
PROXY_PORT="3128"
PROXY_URL="http://$PROXY_HOST:$PROXY_PORT"

# java
java_opts=("-Dhttp.proxyHost=$PROXY_HOST" "-Dhttp.proxyPort=$PROXY_PORT" "${java_opts[@]}")
java_opts=("-Dhttps.proxyHost=$PROXY_HOST" "-Dhttps.proxyPort=$PROXY_PORT" "${java_opts[@]}")

# pip & conda
export HTTP_PROXY="$PROXY_URL"
export HTTPS_PROXY="$PROXY_URL"

# apt
echo "Acquire {
  HTTP::proxy \"$PROXY_URL\";
  HTTPS::proxy \"$PROXY_URL\";
}" | sudo tee /etc/apt/apt.conf.d/proxy.conf
```

3. After the above-mentioned custom images are built, update the Datalore server configuration to use them.

Add the `DATABASES_COMMAND_IMAGE` variable to the Datalore environment and re-define the agent image in the corresponding section as shown in the examples below.

Docker:

> **Note:**
> Find more details on configuring agents in [this topic](configure-docker-agents.html).

`docker-compose.yaml`

```YAML
services:
  datalore:
    ...
    volumes:
      ...
      - "agents-config.yaml:/opt/datalore/configs/agents-config.yaml"
    environment:
      ...
      DATABASES_COMMAND_IMAGE: "datalore-db-command-custom:latest"
...
```

`agent-config.yaml`

```YAML
docker:
  network: datalore-agents-network
  dataloreHost: datalore
  instances:
    - id: basic-agent
      default: true
      label: "Basic"
      image: datalore-agent-custom:latest
      ...
```

Helm:

> **Note:**
> Find more details on configuring agents in [this topic](configure-agents-helm-installation.html).

`datalore.values.yaml`

```YAML
...
dataloreEnv:
  ...
  DATABASES_COMMAND_IMAGE: "datalore-db-command-custom:latest"

agentsConfig:
  k8s:
    instances:
      - id: basic-agent
        default: true
        label: "Basic"
        ...
        yaml:
          apiVersion: v1
          kind: Pod
          metadata:
            name: k8s-agent
            labels:
              podType: dataloreKubernetesAgent
          spec:
            enableServiceLinks: false
            containers:
              - name: agent
                image: datalore-agent-custom:latest
                securityContext:
                  privileged: true
                resources:
                  limits:
                    cpu: "1"
                    memory: "2048Mi"
                  requests:
                    cpu: "200m"
                    memory: "2048Mi"
                ...
```

4. Restart the Datalore server to apply the changes.

