Dockerfile 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # Copyright 2016 The Kubernetes Authors.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # This Dockerfile will build an image that is configured
  15. # to use Fluentd to collect all Docker container log files
  16. # and then cause them to be ingested using the Google Cloud
  17. # Logging API. This configuration assumes that the host performning
  18. # the collection is a VM that has been created with a logging.write
  19. # scope and that the Logging API has been enabled for the project
  20. # in the Google Developer Console.
  21. FROM gcr.io/google_containers/ubuntu-slim:0.4
  22. MAINTAINER Alex Robinson "arob@google.com"
  23. # Disable prompts from apt.
  24. ENV DEBIAN_FRONTEND noninteractive
  25. # Keeps unneeded configs from being installed along with fluentd.
  26. ENV DO_NOT_INSTALL_CATCH_ALL_CONFIG true
  27. RUN apt-get -q update && \
  28. apt-get install -y curl ca-certificates gcc make bash && \
  29. apt-get install -y --reinstall lsb-base lsb-release && \
  30. echo "Installing logging agent" && \
  31. curl -sSL https://dl.google.com/cloudagents/install-logging-agent.sh | bash && \
  32. /usr/sbin/google-fluentd-gem install fluent-plugin-record-reformer -v 0.8.1 && \
  33. /usr/sbin/google-fluentd-gem install fluent-plugin-systemd -v 0.0.3 && \
  34. apt-get remove -y gcc make && \
  35. apt-get autoremove -y && \
  36. apt-get clean && \
  37. rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
  38. /opt/google-fluentd/embedded/share/doc \
  39. /opt/google-fluentd/embedded/share/gtk-doc \
  40. /opt/google-fluentd/embedded/lib/postgresql \
  41. /opt/google-fluentd/embedded/bin/postgres \
  42. /opt/google-fluentd/embedded/share/postgresql \
  43. /var/log/google-fluentd
  44. # Copy the Fluentd configuration files for logging Docker container logs.
  45. # Either configuration file can be used by specifying `-c <file>` as a command
  46. # line argument.
  47. COPY google-fluentd.conf /etc/google-fluentd/google-fluentd.conf
  48. COPY google-fluentd-journal.conf /etc/google-fluentd/google-fluentd-journal.conf
  49. # Start Fluentd to pick up our config that watches Docker container logs.
  50. CMD /usr/sbin/google-fluentd "$FLUENTD_ARGS"