# Deployment using 'docker' command

Use this option to deploy a single docker image containing CloudGuard WAF with a managed reverse proxy.

It is possible to manage the reverse proxy server by yourself. Read the [instructions ](#how-can-i-manage-nginx-myself)further in this document to see the changes in deployment instructions.

## Prerequisites

* Linux machine with:
  * &#x20;Docker installed (or similar, compatible container runtime)
  * &#x20;Root permissions&#x20;

## Configuration

**Note** - package file and folder names contain the name appsec - short for "Application Security" provided by CloudGuard WAF.

#### Step 1: Pull agent container image

As part of your CI, use the [checkpoint/cloudguard-appsec-standalone](https://hub.docker.com/r/checkpoint/cloudguard-appsec-standalone) registry to pull the unified NGINX and Nano-Agent image or use the following command:

```
docker pull checkpoint/cloudguard-appsec-standalone
```

#### Step 2: Obtain the registration token

{% hint style="info" %}
Make sure you obtain the \<token> from the [Enforcement **Profile**](/getting-started/deploy-enforcement-point.md) page, **Authentication** section. you will need it during agent deployment.

![](/files/tAyti9aG3utyFHls2McN)
{% endhint %}

#### Step 3: Run the agent

Run the agent with this command after replacing \<token> with the copied token from previous step and removing unneeded optional parameters:

```
docker run -d --name=agent-container [-v=<path to persistent location for agent config>:/etc/cp/conf] [-v=<path to persistent location for agent data files>:/etc/cp/data] [-v=<path to persistent location for agent debugs and logs>:/var/log/nano_agent] [-v=<path to persistent location for nginx server conf files>:/etc/nginx/conf.d/] [-v=/appsec/etc/certs:/etc/certs/] [-e https_proxy=<user:password@Proxy address:port>] [-p <host SSL port>:443] [-p <host http port>:80] [-p <host health-check port>:8117] -it checkpoint/cloudguard-appsec-standalone /cloudguard-appsec-standalone --token <token>
```

Unique Parameters explanation:

<table><thead><tr><th width="371">Parameter</th><th width="245.33333333333331">Description</th><th>Required?</th></tr></thead><tbody><tr><td><code>-v=/appsec/etc/certs:/etc/certs/</code></td><td>Map persistent storage path for certificates to /etc/certs of the container.<br><strong>Note</strong>: We recommend using /appsec/etc/certs and refer to it in our <a href="/pages/cjtsbJjyRCQIGCtBOILN">documentation for storing certificates</a>.</td><td>Yes for managed Reverse Proxy. <br><br>If the web server uses only HTTP there is no need for this parameter.<br><br>When managing Reverse Proxy by yourself, map the certificates according to your own deployment design.</td></tr><tr><td><code>-v=&#x3C;path to persistent location for nginx server conf files>:/etc/nginx/conf.d/</code></td><td>Map persistent storage path for NGINX configuration files.</td><td>Yes when using the "unmanaged option". In this option the external persistent path is the means to locally manage the NGINX.</td></tr><tr><td><code>-v=&#x3C;path to persistent location for agent config>:/etc/cp/conf</code><br><code>-v=&#x3C;path to persistent location for agent data files>:/etc/cp/data</code><br><code>-v=&#x3C;path to persistent location for agent debugs and logs>:/var/log/nano_agent</code></td><td>Map persistent storage path for agent files.<br>Can be useful for debugging purposes if a container is no longer available.</td><td>No</td></tr><tr><td><code>-e https_proxy</code></td><td>Configure a proxy server for outbound traffic, if applicable.</td><td>No. Needed only in the specific case of outbound traffic through a proxy server.</td></tr><tr><td><code>-p &#x3C;host health-check port>:8117</code></td><td>Expose an external port for health checks</td><td>Yes</td></tr><tr><td><code>-p &#x3C;host http port>:80</code></td><td>Expose an external port for incoming HTTP traffic</td><td>Yes</td></tr><tr><td><code>-p &#x3C;host SSL port:443]</code></td><td>Expose an external port for incoming HTTPS traffic</td><td>Yes<br><br>If the web server uses only HTTP do not use this parameter.</td></tr></tbody></table>

{% hint style="info" %}
For debugging purpose it is possible to activate an SSH server within the docker container by using the following parameters when running the docker. **For security reasons, it is  NOT recommended to use this option in production.**\
\
`--ssh-enable --ssh-user <username> --ssh-hash <hash>`<br>

The hash of you password can be calculated like this:

*`openssl passwd -6 -salt <user-salt> ClearTextPassword`*

1. *-6 indicates SHA-512*
2. \<user-salt> is to randomize the encryption
   {% endhint %}

#### Step 4: Deploy the container

Deploy the unified container.

To make sure that it is running, run: `docker ps`.

#### Step 5: Verify installation

Following the steps above, the agent will install and connect automatically. <br>

Run the following command to check the status:

```
docker exec -it <CONTAINER_NAME> cpnano -s
```

\
CloudGuard AppSec web portal should also display a successful connection message:

<figure><img src="/files/B5QRYAp16foZFHtumQU3" alt=""><figcaption></figcaption></figure>

#### Step 6: Certificates deployment (if the traffic is encrypted via HTTP)

{% content-ref url="/pages/cjtsbJjyRCQIGCtBOILN" %}
[Store Certificates Locally on Docker](/getting-started/deploy-enforcement-point/docker/single-docker/deployment-using-docker-command/store-certificates-locally-on-docker.md)
{% endcontent-ref %}

## How can I manage NGINX myself?

It is possible to have only security aspects managed centrally and manage nginx.conf and other config files by yourself.

### Configuration

* There is no need to add the upsteam URL for each Web application asset, because you will configure it yourself.
* When creating a new Docker profile, make sure to select the option "**I want to manage NGINX myself not via this management**"

<figure><img src="/files/TWZeArKIWEsjvicHzWMw" alt=""><figcaption></figcaption></figure>

#### Running the agent (Step 3)

Run the agent with this command after replacing \<token> with the copied token from previous step and removing unneeded optional parameters:

```
docker run -d --name=agent-container [-v=<path to persistent location for agent config>:/etc/cp/conf] [-v=<path to persistent location for agent data files>:/etc/cp/data] [-v=<path to persistent location for agent debugs and logs>:/var/log/nano_agent] -v=<path to persistent location for nginx server conf files>:/etc/nginx/conf.d/ [-e https_proxy=<user:password@Proxy address:port>] -it checkpoint/cloudguard-appsec-standalone /cloudguard-appsec-standalone --token <token> --nginx-self-managed
```

{% hint style="warning" %}
Note the addition of the **`--nginx-self-managed`** parameter in the end of the command.

Similar to managed Reverse proxy installation, almost all `"-v"` parameters and the `–e https_proxy` parameter are optional, **except for the path to persistent location for nginx server conf files**.

For more info on each parameter see table above.
{% endhint %}

#### Certificate management (Step 6)

To configure SSL certificates follow this guide for [NGINX](https://nginx.org/en/docs/http/configuring_https_servers.html).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://waf-doc.inext.checkpoint.com/getting-started/deploy-enforcement-point/docker/single-docker/deployment-using-docker-command.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
