Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi arch docker images #3619

Closed
miekg opened this Issue Dec 24, 2017 · 4 comments

Comments

Projects
None yet
4 participants
@miekg
Copy link

miekg commented Dec 24, 2017

It seems the docker images on hub.docker are only for amd64.

It would be nice to make them multiarch and add support for: arm, arm64, ppc, s390x.

We've done with in CoreDNS, see https://github.com/coredns/coredns/blob/master/Makefile.release

@vielmetti

This comment has been minimized.

Copy link

vielmetti commented Dec 24, 2017

Agreed. Looping @tianon in on this too.

@tianon

This comment has been minimized.

Copy link

tianon commented Dec 27, 2017

I've had success with something like the following, but it requires building natively on all platforms: (which we'd be happy to help with if Prometheus wanted to participate in https://github.com/docker-library/official-images, which we'd also be happy to help facilitate)

FROM alpine:3.7

WORKDIR /opt/prometheus
ENV PATH /opt/prometheus:$PATH

# https://github.com/prometheus/prometheus/releases
ENV PROMETHEUS_VERSION 2.0.0

RUN set -ex; \
	\
	apk add --no-cache --virtual .fetch-deps \
		ca-certificates \
		libressl \
	; \
	\
	apkArch="$(apk --print-arch)"; \
	case "$apkArch" in \
		aarch64) promArch='arm64'   ;; \
		armhf)   promArch='armv6'   ;; \
		ppc64le) promArch='ppc64le' ;; \
		s390x)   promArch='s390x'   ;; \
		x86)     promArch='386'     ;; \
		x86_64)  promArch='amd64'   ;; \
	esac; \
	\
	wget -O /tmp/prom.tar.gz "https://github.com/prometheus/prometheus/releases/download/v${PROMETHEUS_VERSION}/prometheus-${PROMETHEUS_VERSION}.linux-${promArch}.tar.gz"; \
	tar \
		--extract \
		--file /tmp/prom.tar.gz \
		--strip-components 1 \
		--verbose \
	; \
	rm /tmp/prom.tar.gz; \
	\
	prometheus --version; \
	\
	apk del .fetch-deps

VOLUME /opt/prometheus/data

EXPOSE 9090
CMD ["prometheus"]

Otherwise, this should be pretty easy to accomplish with either cross-building (like what I believe that CoreDNS makefile is doing) or even multi-stage builds (perhaps with an ARG for "target architecture"):

FROM alpine:3.7 AS download

ARG arch=amd64

RUN apk add --no-cache libressl ca-certificates && wget "...-linux.$arch..." # ...

ARG from=amd64/alpine:3.7
FROM $from

COPY --from=download /path/to/prometheus /path/

CMD ["prometheus"]

then building via docker build --arg arch=386 --arg from=i386/alpine:3.7 ... for example

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Mar 20, 2018

prometheus/promu#89 is where to discuss this.

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 22, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 22, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.