-
Notifications
You must be signed in to change notification settings - Fork 189
/
Dockerfile
64 lines (52 loc) · 2.16 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
FROM debian:buster-20200803-slim
MAINTAINER Datadog <[email protected]>
ARG AGENT_VERSION_ARG=1:5.32.7-1
ARG AGENT_REPO_ARG=http://apt.datad0g.com/
ARG AGENT_REPO_CHANNEL_ARG=stable
ENV DOCKER_DD_AGENT=yes \
AGENT_VERSION=$AGENT_VERSION_ARG \
AGENT_REPO=$AGENT_REPO_ARG \
AGENT_REPO_CHANNEL=$AGENT_REPO_CHANNEL_ARG \
DD_ETC_ROOT=/etc/dd-agent \
PATH="/opt/datadog-agent/embedded/bin:/opt/datadog-agent/bin:${PATH}" \
PYTHONPATH=/opt/datadog-agent/agent \
DD_CONF_LOG_TO_SYSLOG=no \
NON_LOCAL_TRAFFIC=yes \
DD_SUPERVISOR_DELETE_USER=yes \
DD_CONF_PROCFS_PATH="/host/proc"
# workaround for stretch-slim missing man dirs
RUN seq 1 8 | xargs -I{} mkdir -p /usr/share/man/man{}
# Install the Agent
RUN apt-get update \
&& apt-get install --no-install-recommends -y gnupg dirmngr \
&& echo "deb ${AGENT_REPO} ${AGENT_REPO_CHANNEL} main" > /etc/apt/sources.list.d/datadog.list \
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A2923DFF56EDA6E76E55E492D3A80E30382E94DE \
&& apt-get update \
&& apt-get install --no-install-recommends -y datadog-agent="${AGENT_VERSION}" \
&& apt-get install --no-install-recommends -y ca-certificates \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Add healthcheck script
COPY probe.sh /probe.sh
# Configure the Agent
# 1. Remove dd-agent user from init.d configuration
# 2. Fix permission on /etc/init.d/datadog-agent
# 3. Make healthcheck script executable
RUN mv ${DD_ETC_ROOT}/datadog.conf.example ${DD_ETC_ROOT}/datadog.conf \
&& sed -i 's/AGENTUSER="dd-agent"/AGENTUSER="root"/g' /etc/init.d/datadog-agent \
&& chmod +x /etc/init.d/datadog-agent \
&& chmod +x /probe.sh
# Add Docker check
COPY conf.d/docker_daemon.yaml ${DD_ETC_ROOT}/conf.d/docker_daemon.yaml
# Add install and config files
COPY entrypoint.sh /entrypoint.sh
COPY config_builder.py /config_builder.py
# Extra conf.d and checks.d
VOLUME ["/conf.d", "/checks.d"]
# Expose DogStatsD and trace-agent ports
EXPOSE 8125/udp 8126/tcp
# Healthcheck
HEALTHCHECK --interval=5m --timeout=3s --retries=1 \
CMD ./probe.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["supervisord", "-n", "-c", "/etc/dd-agent/supervisor.conf"]