Home Operation and Maintenance Docker what is docker alpine

what is docker alpine

Dec 09, 2021 pm 03:55 PM

docker alpine is a kind of image. The Alpine Docker image inherits the advantages of the Alpine Linux distribution. Compared with other Docker images, its capacity is very small, only about 5MB, and it has very friendly package management. mechanism.

what is docker alpine

The operating environment of this article: ubuntu 18.04 system, Docker version 20.10.11, Dell G3 computer.

What is docker alpine?

Alpine operating system is a security-oriented lightweight Linux distribution. It is different from ordinary Linux distributions. Alpine uses musl libc and busybox to reduce the system size and runtime resource consumption. However, its functions are much more complete than busybox, so it is increasingly favored by the open source community. While maintaining weight, Alpine also provides its own package management tool apk. You can query package information through the https://pkgs.alpinelinux.org/packages website, or you can directly query and install various software through the apk command.

Alpine is a Linux distribution maintained by a non-commercial organization and supports a wide range of scenarios. It is specially optimized for experienced/heavy Linux users, focusing on security, performance and resource efficiency. Alpine images can be applied to more common scenarios and are an excellent basic system/environment suitable for production.

The Alpine Docker image also inherits these advantages of the Alpine Linux distribution. Compared with other Docker images, its capacity is very small, only about 5 MB (compared to nearly 200 MB for Ubuntu series images), and it has a very friendly package management mechanism. The official image is from the docker-alpine project.

Currently, Docker officials have begun to recommend using Alpine to replace the previous Ubuntu as the basic mirror environment. This brings several benefits. Including accelerated image download speed, improved image security, more convenient switching between hosts, and occupying less disk space.

The following table is a size comparison of official images:

REPOSITORY          TAG           IMAGE ID          VIRTUAL SIZE
alpine              latest        4e38e38c8ce0      4.799 MB
debian              latest        4d6ce913b130      84.98 MB
ubuntu              latest        b39b81afc8ca      188.3 MB
centos              latest        8efe422e6104      210 MB
Copy after login

Get and use the official image

Since the image is very small, The download time is often very short. Readers can directly use the docker run command to directly run an Alpine container and specify the Linux command to run, for example:

$ docker run alpine echo '123'
123
Copy after login

Migrate to Alpine base image

Currently, most Docker official images already support Alpine as a base image and can be easily migrated.

For example:

ubuntu/debian -> alpine
python:3 -> python:3-alpine
ruby:2.6 -> ruby:2.6-alpine
Copy after login

In addition, if you use the Alpine image to replace the Ubuntu base image, you need to use the apk package manager to replace the apt tool when installing the software package, such as

$ apk add --no-cache <package>
Copy after login

Alpine The name of the software installation package may be different from other distributions. You can search and determine the installation package name on the https://pkgs.alpinelinux.org/packages website. If the required installation package is not in the main index, but is in the test or community index. Then you can use these installation packages as follows.

$ echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
$ apk --update add --no-cache <package>
Copy after login

Since accessing the apk warehouse in China is slow, it is recommended to replace the warehouse address with the domestic mirror before using the apk.

RUN sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" /etc/apk/repositories \
      && apk add --no-cache <package>
Copy after login

Recommended learning: "Docker Video Tutorial"

The above is the detailed content of what is docker alpine. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How do I deploy applications to a Docker Swarm cluster? How do I deploy applications to a Docker Swarm cluster? Mar 17, 2025 pm 04:20 PM

The article details deploying applications to Docker Swarm, covering preparation, deployment steps, and security measures during the process.

What are Kubernetes pods, deployments, and services? What are Kubernetes pods, deployments, and services? Mar 17, 2025 pm 04:25 PM

The article explains Kubernetes' pods, deployments, and services, detailing their roles in managing containerized applications. It discusses how these components enhance scalability, stability, and communication within applications.(159 characters)

How do I scale applications in Kubernetes? How do I scale applications in Kubernetes? Mar 17, 2025 pm 04:28 PM

The article discusses scaling applications in Kubernetes using manual scaling, HPA, VPA, and Cluster Autoscaler, and provides best practices and tools for monitoring and automating scaling.

How do I manage deployments in Kubernetes? How do I manage deployments in Kubernetes? Mar 17, 2025 pm 04:27 PM

The article discusses managing Kubernetes deployments, focusing on creation, updates, scaling, monitoring, and automation using various tools and best practices.

How do I manage services in Docker Swarm? How do I manage services in Docker Swarm? Mar 17, 2025 pm 04:22 PM

Article discusses managing services in Docker Swarm, focusing on creation, scaling, monitoring, and updating without downtime.

How do I implement rolling updates in Docker Swarm? How do I implement rolling updates in Docker Swarm? Mar 17, 2025 pm 04:23 PM

The article discusses implementing rolling updates in Docker Swarm to update services without downtime. It covers updating services, setting update parameters, monitoring progress, and ensuring smooth updates.

What Are the Best Ways to Optimize Docker for Low-Latency Applications? What Are the Best Ways to Optimize Docker for Low-Latency Applications? Mar 14, 2025 pm 02:00 PM

The article discusses strategies to optimize Docker for low-latency applications, focusing on minimizing image size, using lightweight base images, and adjusting resource allocation and network settings.

How do I optimize Docker images for size and performance? How do I optimize Docker images for size and performance? Mar 14, 2025 pm 02:14 PM

Article discusses optimizing Docker images for size and performance using multi-stage builds, minimal base images, and tools like Docker Scout and Dive.

See all articles