0

我正在尝试在 Docker 中安装和设置insightops(log-entries) Linux 代理以在容器中使用日志条目代理

添加 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

在构建图像时,它向我抛出了错误------------------------- ------

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.

如果需要在 docker 容器上设置它,请任何人都可以帮助我并建议我另一种方式。

注意:我不想使用 insightops(log-entries) docker 代理。

文档如下:https ://insightops.help.rapid7.com/v1.0/docs/insight-agent-on-linux

4

1 回答 1

1

为了解决这个问题,我们需要为完整容器功能添加特权标志并在容器上启动 init 进程

添加泊坞窗文件:

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

编写文件:

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

使用以下命令构建并运行映像

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

它将在容器中运行 Linux 代理重新启动容器

于 2018-04-15T18:38:59.853 回答