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?

Blog    

Recommend

Mysql optimization tool (recommended)

Preface While browsing GitHub today, I found this...

JavaScript to achieve simple drag effect

This article shares the specific code of JavaScri...

Programs to query port usage and clear port usage in Windows operating system

In Windows operating system, the program to query...

CSS complete parallax scrolling effect

1. What is Parallax scrolling refers to the movem...

Detailed explanation of MySQL solution to USE DB congestion

When we encounter a fault, we often think about h...

Navicat cannot create function solution sharing

The first time I wrote a MySQL FUNCTION, I kept g...

Examples of common Nginx misconfigurations

Table of contents Missing root location Off-By-Sl...

Summary of 7 types of logs in MySQL

There are the following log files in MySQL: 1: re...

MySQL-group-replication configuration steps (recommended)

MySQL-Group-Replication is a new feature develope...

Docker - Summary of 3 ways to modify container mount directories

Method 1: Modify the configuration file (need to ...

Zabbix monitoring docker application configuration

The application of containers is becoming more an...

Deep understanding of JavaScript syntax and code structure

Table of contents Overview Functionality and read...

SQL Server Comment Shortcut Key Operation

Batch comments in SQL Server Batch Annotation Ctr...

CentOS 7 installation and configuration tutorial under VMware10

If Ubuntu is the most popular Linux operating sys...