Building the MongoDB Docker container

The MongoDB component that the orchestrator requires is supplied in the Kaspersky NGFW distribution kit as an archive containing executable files for building your own Docker container. You can build the MongoDB Docker container for Astra Linux 1.8.3 or Ubuntu 24.

Alongside the software, Kaspersky Lab provides the User with a script that, when running, can interact with software of third-party copyright holders. The user is solely responsible for the use of any software of third-party copyright holders, and also assumes all risks when using such software.

To build a Docker container, you need the Docker utility. Depending on your operating system, you can learn more about installing the Docker utility from the following resources:

To build the MongoDB Docker container:

  1. Create a mongo directory for the files required to build the container:

    mkdir mongo

    cd mongo

  2. Copy the mongo-r5.0.7-astra-1.8.1-bin-x86_64.tgz archive with the MongoDB executable files from the distribution kit into the directory you just created and extract the archive:

    cp /tmp/mongo-r5.0.7-astra*.tgz .

    tar xzf mongo-r5.0.7-astra*.tgz

  3. Prepare the executable files for building the Docker container:

    mv mongo-r5.0.7-astra*/etc .

    mv mongo-r5.0.7-astra*/usr .

    rm -rf mongo-r5.0.7-astra*

  4. Set the BASE_IMAGE environment variable to the name of the Docker image:
    • For Astra Linux:

      export BASE_IMAGE=registry.astralinux.ru/library/astra/ubi18:1.8.3

    • For Ubuntu:

      export BASE_IMAGE=ubuntu:24.04

  5. Create a Dockerfile describing the instructions for creating a Docker container by running the following command:

    cat > Dockerfile <<EOF

    FROM $BASE_IMAGE

    WORKDIR /

    RUN apt-get update && apt-get install -y libcurl4 && rm -rf /var/lib/apt/lists/*

    RUN groupadd --system mongodb && useradd --system --no-create-home -g mongodb mongodb

    RUN mkdir -p /home/mongodb && chown mongodb:mongodb /home/mongodb

    RUN mkdir -p /var/lib/mongodb && mkdir -p /var/log/mongodb && chown -R mongodb:mongodb /var/lib/mongodb /var/log/mongodb

    COPY usr/ /usr

    COPY etc/ /etc

    RUN mkdir -p /data/db && chown -R mongodb:mongodb /data/db

    USER mongodb

    EXPOSE 27017

    CMD ["mongod", "--bind_ip_all", "--logpath", "/var/log/mongodb/mongod.log", "--dbpath", "/var/lib/mongodb"]

    EOF

  6. Start building the MongoDB Docker container:

    docker build -t mongo:5.0.7-knbe-custom .

  7. After the Docker container is successfully built, save it as a .tar archive for subsequent distribution to other nodes when the orchestrator is deployed:

    docker save --output mongo_5.0.7-knbe-custom.tar mongo:5.0.7-knbe-custom

The MongoDB Docker container is successfully built.

Page top