dockerlogentries

How to install Insightops(log-entries ) Agent on ubuntu container


I am trying to install and setup insightops(log-entries) Linux agent in Docker to use log-entries agent in the container

Adding the Dockerfile-

FROM ubuntu:16.04
RUN apt-get update -y
COPY Linux_Insight_Agent/ /app/
RUN chmod u+x /app/agent_installer.sh
RUN ./app/agent_installer.sh install_start

at the time of build the image it is throwing me the error -------------------------------------------

Installing systemd service [INFO]
Failed to connect to bus: No such file or directory
Configuration file /etc/systemd/system/ir_agent.service is marked executable. Please remove executable permission bits. Proceeding anyway.
Created symlink /etc/systemd/system/default.target.wants/ir_agent.service, pointing to /etc/systemd/system/ir_agent.service.

Please anyone can help me on this and suggest me some another way if required to setup it on docker container.

NOTE: I don't want to use insightops(log-entries) docker agent.

Document followed: https://insightops.help.rapid7.com/v1.0/docs/insight-agent-on-linux


Solution

  • To fix this problem we need to add privileged flag for Full container capabilities and start init process on the container

    Adding docker file:

    FROM ubuntu:latest
    #To start init process in container on runtime
    ENTRYPOINT  ["/sbin/init"]
    COPY ./Linux_Insight_Agent/Linux_Insight_Agent
    RUN chmod -R 755 /Linux_Insight_Agent
    #Install and start the Agent on container
    RUN /Linux_Insight_Agent/agent_installer.sh install
    RUN /Linux_Insight_Agent/agent_installer.sh start
    

    Compose file:

     version: "2" 
        services:
          le:
            build:
              context: ./
              dockerfile: Dockerfile
            image: test-le:latest
            privileged: true
            restart: always
            volumes:
             - /var/log:/rest/out
    

    Build and run the Image using below command

    docker-compose -f docker-compose.yml up -d
    

    It will restart the container with running Linux agent in the container