Docker
This page describes the steps for deploying NXLog Agent as a Docker container application.
Deploying an NXLog Agent container application
First, download the NXLog Agent Docker image from the NXLog website.
-
Log in to your account, then click My account at the top of the page.
-
Under the Downloads > NXLog Agent files tab, choose the
nxlog-6.2.9212_docker.tar.gz
archive. The image is based on CentOS 7. -
Use SFTP or a similar secure method to transfer the archive to the target server.
-
Log in to the target server and extract the contents of the archive.
$ tar -xzf nxlog-6.2.9212_docker.tar.gz
Table 1. Files in the NXLog Agent Docker archive Package Description Dockerfile
The main NXLog Agent Docker definition file.
README.md
Readme for building the NXLog Agent Docker image.
nxlog-6.2.9212_rhel7_x86_64.tar.bz2
The NXLog Agent RHEL7 installer file.
-
Configure NXLog Agent. You can place custom configuration files in the build directory of the NXLog Agent Docker version before building the image. Every file ending with
.conf
will be copied into the Docker image and placed in the/opt/nxlog/etc/nxlog.d
directory. The default NXLog Agent configuration file includes all.conf
files found in this directory. -
Build the NXLog Agent Docker image.
-
Use the following command to build an image with a standalone NXLog Agent.
$ docker build -t nxlog .
-
It is also possible to specify the IP address of NXLog Platform at build time. In this case, NXLog Agent will connect automatically at startup. Before building the image, copy the NXLog Platform CA certificate file in PEM format and named
agent-ca.pem
to the Docker build directory.$ docker build -t nxlog --build-arg NXLOG_MANAGER=<NXLOG-MANAGER-IP> .
-
-
Run the container using the
docker
command.$ docker run -p <HostPort>:<ContainerPort> -d nxlog
-
Check that the NXLog Agent container is running with the
docker
command.$ docker ps | grep nxlog a3b4d6240e9d nxlog "/opt/nxlog/bin/nx..." 7 seconds ago Up 6 seconds 0.0.0.0:1514->1514/tcp cranky_perlman [...]
Upgrading NXLog Agent
The upgrade process consists of building a new NXLog Agent Docker image and deploying a new container instance from the new image.
-
Follow steps 1-6 in the deployment instructions above to build a new Docker image.
-
Retrieve the container ID of the existing NXLog Agent container and stop it.
$ docker ps | grep nxlog $ docker stop <containerID>
-
Deploy the new container using the
docker
command.$ docker run -p <HostPort>:<ContainerPort> -d nxlog
-
Check that the new NXLog Agent container is running.
$ docker ps | grep nxlog a3b4d6240e9d nxlog "/opt/nxlog/bin/nx..." 7 seconds ago Up 6 seconds 0.0.0.0:1514->1514/tcp cranky_perlman [...]
-
You can remove any old containers and images that you’re no longer using with
docker rm -v <containerID>
anddocker rmi <imageID>
, respectively. See the uninstall instructions below for more information.
Removing an NXLog Agent container application
Follow these steps to remove an existing NXLog Agent container and image.
-
Retrieve the container ID of the NXLog Agent container and stop it.
$ docker ps | grep nxlog $ docker stop <containerID>
-
Remove the container.
$ docker rm -v <containerID>
-
List any other stopped containers with
docker ps -a
and remove them.$ docker ps -a | grep nxlog $ docker rm -v <containerID>
-
Finally, list and remove any NXLog Agent Docker images.
$ docker images $ docker rmi <imageID>