Skip to content

Commit f5302be

Browse files
authored
Merge pull request #742 from linuxserver/universal-docker-buildx
universal-docker: add buildx, deprecate armhf
2 parents 53b4121 + 098df93 commit f5302be

File tree

3 files changed

+21
-29
lines changed

3 files changed

+21
-29
lines changed

Dockerfile

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ FROM ghcr.io/linuxserver/baseimage-alpine:3.17 as buildstage
55
ARG MOD_VERSION
66

77
RUN \
8-
echo "**** install packages ****" && \
9-
apk add --no-cache \
10-
git \
11-
go && \
128
echo "**** retrieve latest version ****" && \
139
if [[ -z "${MOD_VERSION+x}" ]]; then \
1410
DOCKER_RELEASE=$(curl -sX GET "https://api.github.com/repos/moby/moby/releases/latest" \
@@ -25,7 +21,6 @@ RUN \
2521
mkdir -p \
2622
/root-layer/docker-bins \
2723
/tmp/docker_x86_64 \
28-
/tmp/docker_armv7l \
2924
/tmp/docker_aarch64 && \
3025
curl -fo \
3126
/tmp/docker_x86_64.tgz -L \
@@ -34,13 +29,6 @@ RUN \
3429
/tmp/docker_x86_64.tgz -C \
3530
/tmp/docker_x86_64 --strip-components=1 && \
3631
cp /tmp/docker_x86_64/docker /root-layer/docker-bins/docker_x86_64 && \
37-
curl -fo \
38-
/tmp/docker_armv7l.tgz -L \
39-
"https://download.docker.com/linux/static/stable/armhf/docker-${DOCKER_RELEASE}.tgz" && \
40-
tar xf \
41-
/tmp/docker_armv7l.tgz -C \
42-
/tmp/docker_armv7l --strip-components=1 && \
43-
cp /tmp/docker_armv7l/docker /root-layer/docker-bins/docker_armv7l && \
4432
curl -fo \
4533
/tmp/docker_aarch64.tgz -L \
4634
"https://download.docker.com/linux/static/stable/aarch64/docker-${DOCKER_RELEASE}.tgz" && \
@@ -52,9 +40,6 @@ RUN \
5240
curl -fo \
5341
/root-layer/docker-bins/docker-compose_x86_64 -L \
5442
"https://github.com/docker/compose/releases/download/v${COMPOSE_RELEASE}/docker-compose-linux-x86_64" && \
55-
curl -fo \
56-
/root-layer/docker-bins/docker-compose_armv7l -L \
57-
"https://github.com/docker/compose/releases/download/v${COMPOSE_RELEASE}/docker-compose-linux-armv7" && \
5843
curl -fo \
5944
/root-layer/docker-bins/docker-compose_aarch64 -L \
6045
"https://github.com/docker/compose/releases/download/v${COMPOSE_RELEASE}/docker-compose-linux-aarch64" && \
@@ -71,16 +56,18 @@ RUN \
7156
curl -fo \
7257
/root-layer/docker-bins/compose-switch_aarch64 -L \
7358
"https://github.com/docker/compose-switch/releases/download/v${SWITCH_RELEASE}/docker-compose-linux-arm64" && \
74-
echo "**** compile compose switch on armhf ****" && \
59+
echo "**** retrieve latest buildx version ****" && \
60+
if [ -z ${BUILDX_RELEASE+x} ]; then \
61+
BUILDX_RELEASE=$(curl -sX GET "https://api.github.com/repos/docker/buildx/releases/latest" \
62+
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
63+
fi && \
64+
echo "**** grab buildx plugin ****" && \
7565
curl -fo \
76-
/tmp/compose-switch.tar.gz -L \
77-
"https://github.com/docker/compose-switch/archive/refs/tags/v${SWITCH_RELEASE}.tar.gz" && \
78-
mkdir -p /tmp/compose-switch && \
79-
tar xf \
80-
/tmp/compose-switch.tar.gz -C \
81-
/tmp/compose-switch --strip-components=1 && \
82-
cd /tmp/compose-switch && \
83-
CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -ldflags="-s -w -X github.com/docker/compose-switch/internal.Version=${SWITCH_RELEASE}" -o /root-layer/docker-bins/compose-switch_armv7l ./main.go && \
66+
/root-layer/docker-bins/docker-buildx_x86_64 -L \
67+
"https://github.com/docker/buildx/releases/download/${BUILDX_RELEASE}/buildx-${BUILDX_RELEASE}.linux-amd64" && \
68+
curl -fo \
69+
/root-layer/docker-bins/docker-buildx_aarch64 -L \
70+
"https://github.com/docker/buildx/releases/download/${BUILDX_RELEASE}/buildx-${BUILDX_RELEASE}.linux-arm64" && \
8471
chmod +x /root-layer/docker-bins/* && \
8572
rm -rf /tmp/*
8673

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Docker - Docker mod for all images
22

3-
This mod adds `docker` and `docker-compose` binaries to any linuxserver image.
3+
This mod adds the `docker` binary as wells as the `buildx` and the `compose` plug-ins to any linuxserver image.
44

55
**IMPORTANT NOTE**: For docker access inside a container, a volume mapping needs to be added for `/var/run/docker.sock:/var/run/docker.sock:ro` in the container's docker run/create/compose. If you'd like to connect to a remote docker service instead, you don't have to map the docker sock; you can either set an env var for `DOCKER_HOST=remoteaddress` or use the docker cli option `-H`.
66

root/etc/s6-overlay/s6-rc.d/init-mod-universal-docker-setup/run

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,35 @@
22

33
echo "**** installing docker and docker compose ****"
44
ARCH=$(uname -m)
5-
if [ -d "/docker-bins" ] ; then
5+
if [[ "${ARCH}" = "armv7l" ]]; then
6+
echo "**** The universal docker mod no longer supports arm32v7/armhf per https://info.linuxserver.io/issues/2023-07-01-armhf/ ****"
7+
exit 0
8+
fi
9+
if [[ -d "/docker-bins" ]] ; then
610
echo "Copying over docker and docker-compose binaries"
711
mkdir -p /usr/local/lib/docker/cli-plugins
812
mv "/docker-bins/docker-compose_${ARCH}" /usr/local/lib/docker/cli-plugins/docker-compose
13+
mv "/docker-bins/docker-buildx_${ARCH}" /usr/local/lib/docker/cli-plugins/docker-buildx
914
mv "/docker-bins/docker_${ARCH}" /usr/local/bin/docker
1015
mv "/docker-bins/compose-switch_${ARCH}" /usr/local/bin/docker-compose
1116
rm -rf /docker-bins
1217
else
1318
echo "**** docker and docker-compose already installed, skipping ****"
1419
fi
1520

16-
if [ -S /var/run/docker.sock ]; then
21+
if [[ -S /var/run/docker.sock ]]; then
1722
DOCKER_GID=$(stat -c '%g' "/var/run/docker.sock")
1823
if id -G abc | grep -qw "$DOCKER_GID"; then
1924
exit 0
2025
else
2126
DOCKER_NAME=$(getent group "${DOCKER_GID}" | awk -F: '{print $1}')
22-
if [ -z "${DOCKER_NAME}" ]; then
27+
if [[ -z "${DOCKER_NAME}" ]]; then
2328
DOCKER_NAME="dockergroup"
2429
groupadd -g "${DOCKER_GID}" "${DOCKER_NAME}"
2530
fi
2631
usermod -aG "${DOCKER_NAME}" abc
2732
fi
28-
elif [ -n "$DOCKER_HOST" ]; then
33+
elif [[ -n "$DOCKER_HOST" ]]; then
2934
echo "**** Remote docker service $DOCKER_HOST will be used ****"
3035
else
3136
echo "**** Please map /var/run/docker.sock for access to docker service on host. Alternatively you can manually define a remote host address with the docker cli option -H ****"

0 commit comments

Comments
 (0)