Use the docker build kit to build a Docker image that can be used on the Raspberry Pi

Use the docker build kit to build a Docker image that can be used on the Raspberry Pi

Docker Installation

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG ${user_name}

What is build-kit

  • See build ARM based Docker Images
  • Simply put, it is an experimental function that extends docker build

Build with bind as an example

The docker-bind project is an open source custom DNS deployment service, but it does not provide an available image based on linux/aarch64 architecture, so you need to use buildx command to perform the build operation yourself

In the Raspberry Pi system, execute uname -a to view your target architecture

  • linux/aarch64
  • linux/amd64
  • linux/arm64
  • linux/arm/v7

....

# Execute the following command in the Raspberry Pi system git clone https://github.com/sameersbn/docker-bind.git
cd docker-bind
# Modify the Dockerfile content, 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 https://www.webmin.com/jcameron-key.asc \
 && echo "deb http://download.webmin.com/download/repository sarge contrib" >> /etc/apt/sources.list

FROM ubuntu:focal-20200423

LABEL maintainer="[email protected]"

ENV BIND_USER=bind \
  BIND_VERSION=9.16.1 \
  WEBMIN_VERSION=1.970 \
  DATA_DIR=/data

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 entrypoint.sh /sbin/entrypoint.sh

RUN chmod 755 /sbin/entrypoint.sh

EXPOSE 53/udp 53/tcp 10000/tcp

ENTRYPOINT ["/sbin/entrypoint.sh"]

CMD ["/usr/sbin/named"]' > Dockerfile
# Log in to your own docker repository# You are using Alibaba Cloud's image repository, or you can use the dockerhub official repositorydocker login --username=${user_name} registry.cn-hangzhou.aliyuncs.com
docker buildx build --platform linux/aarch64 -t registry.cn-hangzhou.aliyuncs.com/docker-image-lee/bind:aarch64 --no-cache --push .

# If you are building on Mac or Windows, you need to first execute the following command docker buildx create --use

After the push is completed, you can use it on the Raspberry Pi~

refer to

Building ARM based Docker Images

docker buildx build

Build Docker Image for Raspberry Pi

This is the end of this article about using the docker build kit to build a Docker image that can be used on the Raspberry Pi. For more information about the docker build kit and the Raspberry Pi Docker image, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Delete the image operation of none in docker images
  • Solve the problem of docker images disappearing
  • How to operate Docker and images
  • Docker image import and export code examples
  • Solution to Docker image downloading too slowly
  • Analysis of the Docker image construction principle (you can build an image without installing Docker)
  • Use scripts to package and upload Docker images with one click
  • Steps to completely uninstall the docker image

<<:  How to set background blur with CSS

>>:  What are Web Slices?

Recommend

URL representation in HTML web pages

In HTML, common URLs are represented in a variety ...

Detailed explanation of replace into example in mysql

Detailed explanation of replace into example in m...

Building a KVM virtualization platform on CentOS7 (three ways)

KVM stands for Kernel-based Virtual Machine, whic...

React+Antd implements an example of adding, deleting and modifying tables

Table of contents Table/index.js Table/model/inde...

A brief discussion on ifnull() function similar to nvl() function in MySQL

IFNULL(expr1,expr2) If expr1 is not NULL, IFNULL(...

How to implement encryption and decryption of sensitive data in MySQL database

Table of contents 1. Preparation 2. MySQL encrypt...

Friendly Alternatives to Find Tool in Linux

The find command is used to search for files in a...

React implements the expansion and collapse function of complex search forms

Give time time and let the past go. In the previo...

The difference between char, varchar and text field types in MySQL

In MySQL, fields of char, varchar, and text types...

What scenarios are not suitable for JS arrow functions?

Table of contents Overview Defining methods on an...

Detailed examples of converting rows to columns and columns to rows in MySQL

mysql row to column, column to row The sentence i...

How to make a website look taller and more designed

“How to make a website look high-end? Or more des...

Bootstrap 3.0 study notes for beginners

As the first article of this study note, we will ...

CSS 3.0 text hover jump special effects code

Here is a text hovering and jumping effect implem...