Prometheus image for s390x

Prometheus is a very powerful tool for monitoring and alerting. It has also been graduated as a CNCF project. Today, the there is not a s390x official image for Prometheus available on Docker Hub or from However, s390x binaries for Prometheus are part of the release process.

In this post, I will explain how to build a Prometheus container image for s390x. I’ll use the s390x binaries available from the release page and adapt the official Dockerfile to be build on s390x.

First of all, we need to get the Dockerfile and the Prometheus binaries., and setup the build environment. You can adapt the version you want to build by changing the version variable in the example.


$ version=2.9.2
$ mkdir -p .build
$ wget${version}/prometheus-${version}.linux-s390x.tar.gz
$ wget
$ tar -xzvf prometheus-${version}.linux-s390x.tar.gz
$ mv prometheus-${version}.linux-s390x .build/linux-s390x

Now, we need to change the parent image. The official Dockerfile uses busybox from, but unfortunately they don’t support s390x yet. That’s why we can change it to the official busybox docker image. The other sed commands change the location of the files extract from the release tarball to match with the build environment.

$ sed -i "s|quay\.io\/prometheus\/busybox.*:|s390x\/busybox:|g" Dockerfile
$ sed -i "s|documentation\/examples\/prometheus.yml|\.build\/linux-s390x\/prometheus.yml|g" Dockerfile
$ sed -i "s|console_libraries/|\.build\/linux-s390x\/console_libraries|g" Dockerfile
$ sed -i "s|consoles/|\.build\/linux-s390x\/consoles|g" Dockerfile

Now, we can build the docker image:

$ docker build --build-arg ARCH=s390x -t prom/prometheus:v${version} .
Sending build context to Docker daemon  167.4MB
Step 1/19 : ARG ARCH="amd64"
Step 2/19 : ARG OS="linux"
Step 3/19 : FROM busybox:latest
 ---> 446698eb99b9
Step 4/19 : LABEL maintainer="The Prometheus Authors <>"
 ---> Using cache
 ---> a24071e7fc24
Step 5/19 : ARG ARCH="amd64"
 ---> Using cache
 ---> cf90e5c3efee
Step 6/19 : ARG OS="linux"
 ---> Using cache
 ---> e19f4392bc5e
Step 7/19 : COPY .build/${OS}-${ARCH}/prometheus        /bin/prometheus
 ---> Using cache
 ---> ac1cd794ce7a
Step 8/19 : COPY .build/${OS}-${ARCH}/promtool          /bin/promtool
 ---> Using cache
 ---> c12b90cbd537
Step 9/19 : COPY .build/linux-s390x/prometheus.yml  /etc/prometheus/linux-s390x/prometheus.yml
 ---> 828ae23aa1a0
Step 10/19 : COPY .build/linux-s390x/console_libraries                     /usr/share/prometheus/.build/linux-s390x/console_libraries
 ---> 5f7ab99974ec
Step 11/19 : COPY .build/linux-s390x/consoles                              /usr/share/prometheus/.build/linux-s390x/consoles
 ---> 3cdceabf83a7
Step 12/19 : RUN ln -s /usr/share/prometheus/console_libraries /usr/share/prometheus/.build/linux-s390x/consoles /etc/prometheus/
 ---> Running in 4bc45cc68229
Removing intermediate container 4bc45cc68229
 ---> 20766757f31b
Step 13/19 : RUN mkdir -p /prometheus &&     chown -R nobody:nogroup etc/prometheus /prometheus
 ---> Running in 7d7241080bef
Removing intermediate container 7d7241080bef
 ---> 7a7cf7641a93
Step 14/19 : USER       nobody
 ---> Running in ce75f287cc38
Removing intermediate container ce75f287cc38
 ---> caaa1116f599
Step 15/19 : EXPOSE     9090
 ---> Running in 0eb63abdfac4
Removing intermediate container 0eb63abdfac4
 ---> 185ff174b920
Step 16/19 : VOLUME     [ "/prometheus" ]
 ---> Running in 6f291e0ee1fb
Removing intermediate container 6f291e0ee1fb
 ---> 558aa86b6a1f
Step 17/19 : WORKDIR    /prometheus
 ---> Running in c9abe8187958
Removing intermediate container c9abe8187958
 ---> 984b514381d5
Step 18/19 : ENTRYPOINT [ "/bin/prometheus" ]
 ---> Running in 38bc60b8accb
Removing intermediate container 38bc60b8accb
 ---> 31b4db5295ed
Step 19/19 : CMD        [ "--config.file=/etc/prometheus/linux-s390x/prometheus.yml",              "--storage.tsdb.path=/prometheus",              "--web.console.libraries=/usr/share/prometheus/console_libraries",              "--web.console.templates=/usr/share/prometheus/consoles" ]
 ---> Running in 18c62a1d5114
Removing intermediate container 18c62a1d5114
 ---> 02038d066e0e
Successfully built 02038d066e0e
Successfully tagged prom/prometheus:v2.9.2

Verify the container image for Prometheus:

$ docker run --name prometheus -d -p prom/prometheus:v${version}
$ docker logs prometheus
level=info ts=2019-05-08T12:37:45.323Z caller=main.go:285 msg="no time or size retention was set so using the default time retention" duration=15d
level=info ts=2019-05-08T12:37:45.354Z caller=main.go:321 msg="Starting Prometheus" version="(version=2.9.2, branch=HEAD, revision=d3245f15022551c6fc8281766ea62db4d71e2747)"
level=info ts=2019-05-08T12:37:45.354Z caller=main.go:322 build_context="(go=go1.12.4, user=root@1d43b6951e8f, date=20190424-16:45:56)"
level=info ts=2019-05-08T12:37:45.354Z caller=main.go:323 host_details="(Linux 4.15.0-42-generic #45-Ubuntu SMP Thu Nov 15 19:29:11 UTC 2018 s390x d236f57ecad8 (none))"
level=info ts=2019-05-08T12:37:45.354Z caller=main.go:324 fd_limits="(soft=1048576, hard=1048576)"
level=info ts=2019-05-08T12:37:45.354Z caller=main.go:325 vm_limits="(soft=unlimited, hard=unlimited)"
level=info ts=2019-05-08T12:37:45.356Z caller=main.go:640 msg="Starting TSDB ..."
level=info ts=2019-05-08T12:37:45.376Z caller=web.go:416 component=web msg="Start listening for connections" address=
level=info ts=2019-05-08T12:37:45.428Z caller=main.go:655 msg="TSDB started"
level=info ts=2019-05-08T12:37:45.428Z caller=main.go:724 msg="Loading configuration file" filename=/etc/prometheus/linux-s390x/prometheus.yml
level=info ts=2019-05-08T12:37:45.484Z caller=main.go:751 msg="Completed loading of configuration file" filename=/etc/prometheus/linux-s390x/prometheus.yml
level=info ts=2019-05-08T12:37:45.484Z caller=main.go:609 msg="Server is ready to receive web requests."

You can now see the Prometheus dashboard at http://localhost:9090/.

Have fun with Prometheus!

One thought on “Prometheus image for s390x

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s