Enable port forwarding on a Docker container in Q Blocks instance
Last updated
Last updated
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.
For this example we will use Nagios application docker Image:
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:
Click on the "More info" button for your instance on the Instances page in your Dashboard.
Copy the Extra Port and Host URL as shown in the image:
Run the docker container command as follows:
Now access the container application in your browser at the following URL:
This should help you get started with running port forwarded containerized applications that can be accessible publicly.
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.
If you still face issues setting it up then don't hesitate to reach out to us at: support@qblocks.cloud