我正在尝试在Docker中安装和设置insightops(日志条目)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 agent。
随后的文件:https://insightops.help.rapid7.com/v1.0/docs/insight-agent-on-linux
答案 0 :(得分:1)
要解决此问题,我们需要为Full容器功能添加特权标志,并在容器上启动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
使用以下命令构建并运行Image
docker-compose -f docker-compose.yml up -d
它将在容器中运行Linux代理重启容器