前提・実現したいこと
Dockerのコンテナ起動時に、fluentdが起動しているような状態にしたいです。
環境 python2.7のdockerイメージ
発生している問題・エラーメッセージ
特にエラーは出てませんが、コンテナ起動時にfluentdが起動していない状態です。
該当のソースコード
Dockerfile
1FROM python:2.7 2 3# Install uWSGI 4RUN pip install uwsgi 5 6# Standard set up Nginx 7ENV NGINX_VERSION 1.9.11-1~jessie 8 9RUN apt-key adv --keyserver hkp://keyserver.ntzwrk.org --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 \ 10 && echo "deb http://nginx.org/packages/mainline/debian/ jessie nginx" >> /etc/apt/sources.list \ 11 && echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list \ 12 && apt-get update \ 13 && apt-get install -y sudo \ 14 && apt-get install -y ca-certificates nginx=${NGINX_VERSION} gettext-base \ 15 && rm -rf /var/lib/apt/lists/* 16# forward request and error logs to docker log collector 17RUN ln -sf /dev/stdout /var/log/nginx/access.log \ 18 && ln -sf /dev/stderr /var/log/nginx/error.log 19# Finished setting up Nginx 20 21 22 23 24# Azure WebApp docker shh settings 25RUN apt-get update \ 26 && apt-get install -y --no-install-recommends openssh-server \ 27 && echo "root:Docker!" | chpasswd \ 28 && mkdir -p /var/run/sshd 29COPY sshd_config /etc/ssh/ 30 31EXPOSE 5000 2222 80 443 24224 32 33 34 35# GCP 36# Downloading gcloud package 37RUN curl https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz > /tmp/google-cloud-sdk.tar.gz 38 39# Installing the package 40RUN mkdir -p /usr/local/gcloud \ 41 && tar -C /usr/local/gcloud -xvf /tmp/google-cloud-sdk.tar.gz \ 42 && /usr/local/gcloud/google-cloud-sdk/install.sh 43 44# Adding the package path to local 45ENV PATH $PATH:/usr/local/gcloud/google-cloud-sdk/bin 46 47# install fluentd 48RUN curl -L https://toolbelt.treasuredata.com/sh/install-ubuntu-xenial-td-agent3.sh | sh 49 50COPY td-agent.conf /etc/td-agent/ 51COPY schema.json /etc/td-agent/ 52COPY private_key.p12 /etc/td-agent/ 53 54 55RUN pip install fluent-logger 56RUN /opt/td-agent/embedded/bin/fluent-gem install --no-document specific_install 57RUN /opt/td-agent/embedded/bin/fluent-gem specific_install https://github.com/kaizenplatform/fluent-plugin-bigquery.git 58RUN /etc/init.d/td-agent start 59 60COPY ssh.sh /bin/ 61RUN chmod 755 /bin/ssh.sh 62 63# Make NGINX run on the foreground 64RUN echo "daemon off;" >> /etc/nginx/nginx.conf 65# Remove default configuration from Nginx 66RUN rm /etc/nginx/conf.d/default.conf 67# Copy the modified Nginx conf 68COPY nginx.conf /etc/nginx/conf.d/ 69# Copy the base uWSGI ini file to enable default dynamic uwsgi process number 70COPY uwsgi.ini /etc/uwsgi/ 71 72# Install Supervisord 73RUN apt-get install -y supervisor \ 74&& rm -rf /var/lib/apt/lists/* 75# Custom Supervisord config 76COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf 77# copy files 78RUN mkdir /code 79RUN mkdir /code/lp 80RUN mkdir /code/log/ 81WORKDIR /code 82COPY requirements.txt /code/ 83COPY lp /code/lp 84RUN pip install -r requirements.txt 85 86# Which uWSGI .ini file should be used, to make it customizable 87ENV UWSGI_INI /code/lp/uwsgi.ini 88 89# By default, allow unlimited file sizes, modify it to limit the file sizes 90# To have a maximum of 1 MB (Nginx's default) change the line to: 91# ENV NGINX_MAX_UPLOAD 1m 92ENV NGINX_MAX_UPLOAD 0 93 94# Copy the entrypoint that will generate Nginx additional configs 95COPY entrypoint.sh /entrypoint.sh 96RUN chmod +x /entrypoint.sh 97 98ENTRYPOINT ["/entrypoint.sh"] 99 100 101CMD ["/usr/bin/supervisord"] 102
[supervisord] nodaemon=true [program:uwsgi] command=/usr/local/bin/uwsgi --ini /etc/uwsgi/uwsgi.ini --die-on-term stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 [program:nginx] command=/usr/sbin/nginx stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 [program:ssh] command=/usr/sbin/sshd -D autostart=true autorestart=true [program:td-agent] command=td-agent -d --under-supervisor
試したこと
docker run -it -p 80:8080 -p 24224:24224 mydocker/test /bin/bash
2018-08-13 09:26:51 +0000 [info]: starting fluentd-1.2.2 pid=22 ruby="2.4.4" 2018-08-13 09:26:51 +0000 [info]: spawn command to main: cmdline=["/opt/td-agent/embedded/bin/ruby", "-Eascii-8bit:ascii-8bit", "/usr/sbin/td-agent", "--log", "/var/log/td-agent/td-agent.log", "--daemon", "/var/run/td-agent/td-agent.pid", "--under-supervisor"]
ログは上のようになりました。
今の所、コンテナに入っても起動していない状態です。
dockerコンテナ起動時に、すでにfluentdがstartしている状態にしたいです。
よろしくお願いします。
/var/log/td-agent/td-agent.log には何も出力されていないのでしょうか?
Fluentdが起動していないと判断した根拠を教えてください。
あなたの回答
tips
プレビュー