Docker
This topic describes the steps to install and upgrade NXLog on a Docker image.
Installing
First, download the appropriate NXLog install archive from the NXLog website.
-
Log in to your account, then click My account at the top of the page.
-
Under the Downloads > NXLog Enterprise Edition files tab, choose the
nxlog-6.5.9781-docker.tar.gz
archive (which 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 -xvf nxlog-6.5.9781-docker.tar.gz
Table 1. Files in the Docker Archive Package Description Dockerfile
The main NXLog Docker definition file
README.md
Readme for building NXLog Docker image
nxlog-6.5.9781_rhel7_x86_64.tar.bz2
The NXLog RHEL7 package
-
Configure NXLog. Custom configuration files can be placed in the build directory of the NXLog Docker version, before the build. 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 configuration file includes all.conf
files found in this directory. -
Build the NXLog Docker image.
-
The standalone version of NXLog Docker image can be built with this command.
$ docker build -t nxlog .
-
It is also possible to specify the IP address of an NXLog Manager instance at build time. In this case, NXLog will connect automatically at startup. Before build, the CA certificate file, exported from NXLog Manager in PEM format and named
agent-ca.pem
, must be placed in 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 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
The upgrade process consists of creating a new NXLog Docker image build and running a new container instance with the newly built image.
-
Follow steps 1-5 above to build a new Docker image.
-
Get the container ID of the running NXLog instance and stop the running container.
$ docker ps | grep nxlog $ docker stop <containerID>
-
Run the new container using the
docker
command.$ docker run -p <HostPort>:<ContainerPort> -d nxlog
-
Check that the new NXLog 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 [...]
-
Any old containers and images that are no longer needed can be removed with
docker rm -v <containerID>
anddocker rmi <imageID>
, respectively. See Uninstalling below for more information.
Uninstalling
The uninstallation process of the NXLog Docker version is simply removing the running container and the image.
-
Get the container ID of the running NXLog instance and stop the running container.
$ docker ps | grep nxlog $ docker stop <containerID>
-
Remove the stopped container.
$ docker rm -v <containerID>
-
Any other remaining containers that are not running can be listed with
docker ps -a
, and removed.$ docker ps -a | grep nxlog $ docker rm -v <containerID>
-
Finally, list and remove NXLog Docker images.
$ docker images $ docker rmi <containerID>