Run the NGINX Agent in a container
This guide serves as a step-by-step guide to run NGINX Agent in a container. It covers the basic setup needed to get the NGINX Agent up and running efficiently and securely.
Before you begin this guide ensure:
Note: This guide uses Docker but NGINX Agent also works with other container applications.
- Docker: Ensure Docker is installed and configured on your system. Download Docker from the official site.
- Credentials: Acquire any necessary authentication tokens or credentials required for the NGINX Agent.
To run NGINX Agent in a container you will need to download the NGINX Agent container image and create a configuration file.
The NGINX Agent container image must be downloaded from a trusted source such as Docker Hub or a private container registry.
Run the following command to pull the official image:
<!-- Registry HERE -->
docker pull <Registry HERE>:latest
Ensure you are using the correct image version. Replace latest
with the desired version tag if necessary.
Create a configuration file named nginx-agent.conf
in your current directory
and populate the file with the following structure:
command:
server:
host: "<NGINX-One-Console-URL>" # Command server host
port: 443 # Command server port
auth:
token: "<your-data-plane-key-here>" # Authentication token for the command server
tls:
skip_verify: false
Replace the placeholder values:
<NGINX-One-Console-URL>
: The URL of your NGINX One Console instance.<your-data-plane-key-here>
: Your Data Plane access token.
Run the NGINX Agent container with the configuration file mounted.
Use the following command:
docker run -d \
--name nginx-agent \
-v $(pwd)/nginx-agent.conf:/etc/nginx-agent/nginx-agent.conf \
nginx/agent:latest
Key options explained:
-d
: Runs the container in detached mode.--name nginx-agent
: Assigns a name to the container for easy identification.-v $(pwd)/nginx-agent.conf:/etc/nginx-agent/nginx-agent.conf
: Mounts the configuration file into the container.
Check the running status of the container:
docker ps
You should see an entry for nginx-agent
. The STATUS
field indicates that the container is running.
To ensure the container is functioning properly and communicating with NGINX One Console, monitor the container logs.
Run the following command:
docker logs -f nginx-agent
Look for log entries indicating successful connection to the NGINX One Console and periodic metric transmission.