Cannot start td-agent service in docker container #3947
-
Describe the bugI'm unable to run td-agent from within a node-16-bullseye-slim Docker container, but I think this will apply to any base image since I also tried with bullseye, buster-slim and buster To ReproduceTo reproduce the issue, start a container with this Dockerfile which tries to start td-agent and then use node to run start.js :
const nowTime = () => {
console.log(new Date());
};
setInterval(() => {
nowTime();
}, 1000);
FROM node:16-bullseye-slim
RUN apt-get update && apt-get -y install sudo
RUN adduser --disabled-password chalu --uid 9001 --gecos '' --home /home/chalu --shell /bin/bash
RUN adduser chalu sudo
RUN echo '%chalu ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y ca-certificates-java \
&& update-ca-certificates -f \
&& apt-get -qq update \
&& apt-get install -q --yes software-properties-common
RUN apt-get -y install curl procps
RUN curl -fsSL https://toolbelt.treasuredata.com/sh/install-debian-bullseye-td-agent4.sh | sh
ENV APP_HOME /home/chalu/api
RUN mkdir -p $APP_HOME
COPY start.js /home/chalu/api/start.js
USER root
CMD ["sudo", "service", "td-agent", "start"] Expected behaviorI expected the Your Environment- Fluentd version: N/A
- TD Agent version: v4 for Debian Bullseye. See https://docs.fluentd.org/installation/install-by-deb
- Operating system: I am building on Mac OS, but the container is to run on Debian
- Kernel version: 21.6.0 (Mac) Your Configuration<system>
# equal to -qq option
log_level error
</system>
<source>
@type syslog
port 5140
bind 0.0.0.0
tag syslog
</source>
<match {syslog.**}>
@type stdout
</match>
Additional contextThe goal was to run a simple Nodejs app in a container, such that logs from the app are tailed with td-agent and sent to a remote central server. Though to reproduce the issue, I used a simple Dockerfile with
This shell script is then run in the Dockerfile as I tried running |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
My feeling is that what you're describing can be done by creating a bash script like this: #!/bin/bash
td-agent -q -d
node ./start.js ... and launch the container as follows:
That said, I strongly recommend against setting up containers in this way.
The whole point of Docker is to make it very easy to run services in separate The basic technical concept behind Docker is "one container, one app". I think
I did not peek inside the Please ask the image publisher for further details. |
Beta Was this translation helpful? Give feedback.
My feeling is that what you're describing can be done by creating a bash script like this:
#!/bin/bash td-agent -q -d node ./start.js
... and launch the container as follows:
That said, I strongly recommend against setting up containers in this way.
The whole point of Docker is to make it very easy to run services in separate
containers. If you want to run Fluentd, you really should just launch another
container for it.
The basic technical concept behind Docker is "one container, one app". I think
it kinda misses the…