# Enable port forwarding on a Docker container in Q Blocks instance

There could be a scenario where you want to publicly access the running docker container application in your instance. Docker containers support port forwarding through which you can access the application running inside your container at a specified port through browser or APIs.

Q Blocks instances come with an open port by default that can be used to make an application running inside it publicly accessible.

This example assumes that docker engine is already installed in your Q Blocks instance, if not then we would recommend to first install it via this [guide](https://www.notion.so/Setup-Docker-with-Nvidia-GPU-support-08e4a555ec6b461fa38d1242fdbd15a0?pvs=21).

For this example we will use Nagios application docker Image:

```bash
docker pull jasonrivers/nagios
```

Nagios is a monitoring tool and this image is used to launch a container with the Nagios application running inside the container at Port 80. Now to make it viewable on browser we will use port forwarding on the docker container run command.

To enable port forwarding on a container running inside your Q Blocks instance, follow the steps below:

1. Click on the "More info" button for your instance on the Instances page in your Dashboard.
2. Copy the <mark style="color:red;">**Extra Port**</mark> and <mark style="color:purple;">**Host URL**</mark> as shown in the image:

<figure><img src="/files/lauJgqMvPzP98jy2YmrF" alt="" width="563"><figcaption></figcaption></figure>

3. Run the docker container command as follows:

```bash
docker run --name nagios4 -p EXTRA_PORT:80 -d jasonrivers/nagios:latest
```

4. Now access the container application in your browser at the following URL:

```bash
http://HOST_URL:EXTRA_PORT
```

This should help you get started with running port forwarded containerized applications that can be accessible publicly.

{% hint style="danger" %}
**Word of Caution:**

Any application running at a forwarded port is accessible to the public. Right precautions with auth token or password access must be implemented to secure the applications.
{% endhint %}

If you still face issues setting it up then don't hesitate to reach out to us at: [support@qblocks.cloud](mailto:support@qblocks.cloud?subject=Unable%20to%20launch%20TensorBoard)


---

# 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://docs.qblocks.cloud/q-blocks-how-to-guide/enable-port-forwarding-on-a-docker-container-in-q-blocks-instance.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.
