we are trying to build a Metricbeat Image based on ubi8. There are a lot of information's but no one explaines how this can be archived.
I reverse engineered the official Image but there must be another way to build the Image correctly. Some files are missing too (docker-entrypoint, licenses). I am new to containerisation and would appreciate help.
Could someone give advice how we can build this with a Dockerfile and ubi8?
FROM docker.elastic.co/beats/metricbeat:7.11.0
ADD file:b3ebbe8bd304723d43b7b44a6d990cd657b63d93d6a2a9293983a30bfc1dfa53 in /
LABEL org.label-schema.schema-version=1.0 org.label-schema.name=CentOS Base Image org.label-schema.vendor=CentOS org.label-schema.license=GPLv2 org.label-schema.build-date=20201113 org.opencontainers.image.title=CentOS Base Image org.opencontainers.image.vendor=CentOS org.opencontainers.image.licenses=GPL-2.0-only org.opencontainers.image.created=2020-11-13 00:00:00+00:00
CMD ["/bin/bash"]
RUN /bin/sh -c yum -y --setopt=tsflags=nodocs update \
&& yum clean all
LABEL org.label-schema.build-date=2021-02-08T22:52:45Z org.label-schema.schema-version=1.0 org.label-schema.vendor=Elastic org.label-schema.license=Elastic License org.label-schema.name=metricbeat org.label-schema.version=7.11.0 org.label-schema.url=https://www.elastic.co/products/beats/metricbeat org.label-schema.vcs-url=github.com/elastic/beats/v7 org.label-schema.vcs-ref=84c4d4c4034fcb49c1a318ccdc7311d70adee15b io.k8s.description=Metricbeat is a lightweight shipper for metrics. io.k8s.display-name=Metricbeat image org.opencontainers.image.created=2021-02-08T22:52:45Z org.opencontainers.image.licenses=Elastic License org.opencontainers.image.title=Metricbeat org.opencontainers.image.vendor=Elastic name=metricbeat maintainer=infra@elastic.co vendor=Elastic version=7.11.0 release=1 url=https://www.elastic.co/products/beats/metricbeat summary=metricbeat license=Elastic License description=Metricbeat is a lightweight shipper for metrics.
ENV ELASTIC_CONTAINER=true
ENV PATH=/usr/share/metricbeat:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV GODEBUG=madvdontneed=1
RUN /bin/sh -c set -e ; TINI_VERSION='v0.19.0' ; TINI_BIN='tini-amd64' ; TINI_SHA256='93dcc18adc78c65a028a84799ecf8ad40c936fdfc5f2a57b1acda5a8117fa82c' ; curl --retry 8 -S -L -O "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/${TINI_BIN}" ; echo "${TINI_SHA256} ${TINI_BIN}" | sha256sum -c - ; mv "${TINI_BIN}" /usr/bin/tini ; chmod +x /usr/bin/tini
COPY file:0c7d6c5e7a9eb5b92e259f2240c93301dd7753f797052ab786ec388e1df59c6d in /usr/local/bin/docker-entrypoint
RUN /bin/sh -c chmod 755 /usr/local/bin/docker-entrypoint
COPY dir:09dc8cb6603b804a522bc18146951c214bab2ae305c7119180642b7ecc16958e in /usr/share/metricbeat
RUN /bin/sh -c mkdir /licenses
COPY file:cdbc231fbc5655dba62a5dfcd044a7cd1f1ff5c6ed03d382f939f06965440fa3 in /licenses
COPY file:9697170cbb2eabaa1fb3217b51c56b81ef5be1a8d0d7eb1243c52286dde3ce48 in /licenses
RUN /bin/sh -c groupadd --gid 1000 metricbeat
RUN /bin/sh -c useradd -M --uid 1000 --gid 1000 --groups 0 --home /usr/share/metricbeat metricbeat
USER metricbeat
ENV LIBBEAT_MONITORING_CGROUPS_HIERARCHY_OVERRIDE=/
WORKDIR /usr/share/metricbeat
ENTRYPOINT ["/usr/bin/tini" "--" "/usr/local/bin/docker-entrypoint"]
CMD ["-environment" "container"]
I would try with a ubi8 (maybe with golang already installed) base image and then within the same Dockerfile I would try to download the project from the source and build it. The final container image should have the binary.
I'm not sure how easy it is and if even possible (I'm not familiar with ubi8) but is the only thing I can think of right now.
I was able to create the Dockerfile from the source. In this post I would like to share my experience and help others. Many thanks to @jarpy for the right tip´s.
To create a Dockerfile for Metricbeat you have to build the image from source. This will create an image the docker-entry file and dockerfile. This dockerfile you can then customize to your wishes, in my case the use with ubi8.
I created a new centos7 vm for this because I had problems with my Ubuntu desktop python. I would recommend this to you as well.
After the machine is up it's time to install python3, mage, go and a few other tools.
And now we start to build Metricbeat from source under /beats/metricbeat
mage package
No you have to wait 10-15min for the build
What is the outcome?
Under the path in the beats folder
metricbeat/build/package/metricbeat-oss/metricbeat-oss-linux-amd64.docker/
should now be the docker-build folder with all the things you need to build the docker Image. If you do a docker image on your centos vm you will see the Metricbeat image build from source too
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.