Use the docker build kit to build docker images available on raspberry pie


Docker installation

curl -fsSL -o
sudo sh
sudo usermod -aG ${user_name}

What is a build kit

"features": {
    "buildkit": true

Take bind as a case to build

  • docker-bindThe project is an open source custom DNS deployment service, but it does not provide based onlinux/aarch64The available image of the architecture, so you need to use it yourselfbuildxCommand to perform build operations

    • In the raspberry pie system, executeuname -aTo view your target architecture

      • linux/aarch64
      • linux/amd64
      • linux/arm64
      • linux/arm/v7
      • ….
#Execute the following command in the raspberry pie system
git clone
cd docker-bind
#Modify dockerfile content, please pay attention!! This setting is related to docker bind and has nothing to do with the use of build kit. It is only used for demonstration
echo 'FROM ubuntu:focal-20200423 AS add-apt-repositories
COPY jcameron-key.asc jcameron-key.asc
RUN apt-get update \
 && DEBIAN_FRONTEND=noninteractive apt-get install -y gnupg \
 && apt-get install -y curl \
 && apt-key adv --fetch-keys \
 && echo "deb sarge contrib" >> /etc/apt/sources.list

FROM ubuntu:focal-20200423

LABEL maintainer="[email protected]"

    BIND_VERSION=9.16.1 \
    WEBMIN_VERSION=1.970 \

RUN apt-get update \
  && apt-get install -y curl

COPY --from=add-apt-repositories /etc/apt/trusted.gpg /etc/apt/trusted.gpg

COPY --from=add-apt-repositories /etc/apt/sources.list /etc/apt/sources.list

RUN rm -rf /etc/apt/apt.conf.d/docker-gzip-indexes \
 && apt-get update \
 && DEBIAN_FRONTEND=noninteractive apt-get install -y \
      bind9=1:${BIND_VERSION}* bind9-host=1:${BIND_VERSION}* dnsutils \
      webmin=${WEBMIN_VERSION}* \
 && rm -rf /var/lib/apt/lists/*

COPY /sbin/

RUN chmod 755 /sbin/

EXPOSE 53/udp 53/tcp 10000/tcp

ENTRYPOINT ["/sbin/"]

CMD ["/usr/sbin/named"]' > Dockerfile
#Log in to your docker repository
#You can use Alibaba cloud's image warehouse or the official dockerhub warehouse
docker login --username=${user_name}
docker buildx build --platform linux/aarch64  -t --no-cache --push .

#If you are building on MAC or windows, you need to execute the following commands first
docker buildx create --use
  • When the push is complete, you can use it on raspberry pie~

reference resources

Recommended Today

Talk about dragon lizard hardware compatibility sig

Editor’s note: what does dragon lizard community hardware compatibility sig mainly do? How compatible are the hardware devices with each distribution of the dragon lizard operating system? How to evaluate? Let’s talk about the hardware compatibility. This article is compiled from the 12th live broadcast of dragon lizard lecture hall technology. Wu Chaofeng, a core […]