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.

  1. Log in to your account, then click My account at the top of the page.

  2. Under the Downloads > NXLog Agent files tab, choose the nxlog-6.4.9634_docker.tar.gz archive. The image is based on CentOS 7.

  3. Use SFTP or a similar secure method to transfer the archive to the target server.

  4. Log in to the target server and extract the contents of the archive.

    $ tar -xzf nxlog-6.4.9634_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.4.9634_rhel7_x86_64.tar.bz2

    The NXLog Agent RHEL7 installer file.

  5. 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.

  6. 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> .
  7. Run the container using the docker command.

    $ docker run -p <HostPort>:<ContainerPort> -d nxlog
  8. 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.

  1. Follow steps 1-6 in the deployment instructions above to build a new Docker image.

  2. Retrieve the container ID of the existing NXLog Agent container and stop it.

    $ docker ps | grep nxlog
    $ docker stop <containerID>
  3. Deploy the new container using the docker command.

    $ docker run -p <HostPort>:<ContainerPort> -d nxlog
  4. 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
    [...]
  5. You can remove any old containers and images that you’re no longer using with docker rm -v <containerID> and docker 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.

  1. Retrieve the container ID of the NXLog Agent container and stop it.

    $ docker ps | grep nxlog
    $ docker stop <containerID>
  2. Remove the container.

    $ docker rm -v <containerID>
  3. List any other stopped containers with docker ps -a and remove them.

    $ docker ps -a | grep nxlog
    $ docker rm -v <containerID>
  4. Finally, list and remove any NXLog Agent Docker images.

    $ docker images
    $ docker rmi <imageID>