Alpine linux docker image

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Alpine Linux with Docker (Docker-in-Docker) [Docker]

yobasystems/alpine-docker

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

This Docker image (yobasystems/alpine-docker) is based on the minimal Alpine Linux with Docker pre-installed, or even better Docker-in-Docker (dind).

Alpine Version 3.18.2 (Released 2023-06-14)

  • Alpine with Docker
  • What is Alpine Linux?
  • What is Docker in Docker?
  • Features
  • Architectures
  • Tags
  • Layers & Sizes
  • How to use this image
  • Image contents & Vulnerability analysis
  • Source Repositories
  • Container Registries
  • Links
  • Donation

Alpine Linux is a Linux distribution built around musl libc and BusyBox. The image is only 5 MB in size and has access to a package repository that is much more complete than other BusyBox based images. This makes Alpine Linux a great image base for utilities and even production applications. Read more about Alpine Linux here and you can see how their mantra fits in right at home with Docker images.

Although running Docker inside Docker is generally not recommended, there are some legitimate use cases, such as development of Docker itself.

Docker is an open-source project that automates the deployment of applications inside software containers, by providing an additional layer of abstraction and automation of operating-system-level virtualisation on Linux, Mac OS and Windows.

  • :amd64 , :x86_64 — 64 bit Intel/AMD (x86_64/amd64)
  • :arm64v8 , :aarch64 — 64 bit ARM (ARMv8/aarch64)
  • :arm32v7 , :armhf — 32 bit ARM (ARMv7/armhf)

📝 PLEASE CHECK TAGS BELOW FOR SUPPORTED ARCHITECTURES, THE ABOVE IS A LIST OF EXPLANATION

Читайте также:  Raspberry pi альт линукс

  • :latest latest branch based (Automatic Architecture Selection)
  • :master master branch usually inline with latest
  • :dind latest branch with docker-in-docker
  • :amd64 , :x86_64 amd64 based on latest tag but amd64 architecture
  • :dind-amd64 , :dind-x86_64 amd64 based on latest tag but amd64 architecture and includes docker-in-docker
  • :armhf , :arm32v7 Armv7 based on latest tag but arm architecture
  • :dind-armhf , :dind-arm32v7 Armv7 based on latest tag but arm architecture and includes docker-in-docker
  • :aarch64 , :arm64v8 Armv8 based on latest tag but arm64 architecture
  • :dind-aarch64 , :dind-arm64v8 Armv8 based on latest tag but arm64 architecture and includes docker-in-docker

Use like you would any other base image:

FROM yobasystems/alpine-docker RUN apk add --no-cache . . . . .. . 

or maybe a docker run command:

docker run -it --name=dind --privileged -v /var/run/docker.sock:/var/run/docker.sock yobasystems/alpine-docker:dind /bin/sh 

or if you want to use a docker-compose.yml:

version: '3.9' services: alpine-docker: image: yobasystems/alpine-docker:dind container_name: alpine-docker privileged: true volumes: - /var/run/docker.sock:/var/run/docker.sock 

Simply create a docker-compose.yml file with the above content and run docker-compose up -d to start the container.

🔍 Image contents & Vulnerability analysis

Источник

How to Use the Alpine Docker Official Image

With its container-friendly design, the Alpine Docker Official Image (DOI) helps developers build and deploy lightweight, cross-platform applications. It’s based on Alpine Linux which debuted in 2005, making it one of today’s newest major Linux distros.

While some developers express security concerns when using relatively newer images, Alpine has earned a solid reputation. Developers favor Alpine for the following reasons:

  • It has a smaller footprint, and therefore a smaller attack surface (even evading 2014’s ShellShock Bash exploit!).
  • It takes up less disk space.
  • It offers a strong base for customization.
  • It’s built with simplicity in mind.

In fact, the Alpine DOI is one of our most popular container images on Docker Hub. To help you get started, we’ll discuss this image in greater detail and how to use the Alpine Docker Official Image with your next project. Plus, we’ll explore using Alpine to grab the slimmest image possible. Let’s dive in!

What is the Alpine Docker Official Image?

How to use the alpine docker official image 900x600 1

The Alpine DOI is a building block for Alpine Linux Docker containers. It’s an executable software package that tells Docker and your application how to behave. The image includes source code, libraries, tools, and other core dependencies that your application needs. These components help Alpine Linux function while enabling developer-centric features.

The Alpine Docker Official Image differs from other Linux-based images in a few ways. First, Alpine is based on the musl libc implementation of the C standard library — and uses BusyBox instead of GNU coreutils. While GNU packages many Linux-friendly programs together, BusyBox bundles a smaller number of core functions within one executable.

While our Ubuntu and Debian images leverage glibc and coreutils, these alternatives are comparatively lightweight and resource-friendly, containing fewer extensions and less bloat.

As a result, Alpine appeals to developers who don’t need uncompromising compatibility or functionality from their image. Our Alpine DOI is also user-friendly and straightforward since there are fewer moving parts.

Alpine Linux performs well on resource-limited devices, which is fitting for developing simple applications or spinning up servers. Your containers will consume less RAM and less storage space.

Читайте также:  Astra linux слетело разрешение экрана

The Alpine Docker Official Image also offers the following features:

  • The robust apk package manager
  • A rapid, consistent development-and-release cycle vs. other Linux distributions
  • Multiple supported tags and architectures, like amd64 , arm/v6+ , arm64 , and ppc64le

Multi-arch support lets you run Alpine on desktops, mobile devices, rack-mounted servers, Raspberry Pis, and even newer M-series Macs. Overall, Alpine pairs well with a wide variety of embedded systems.

These are only some of the advantages to using the Alpine DOI. Next, we’ll cover how to harness the image for your application.

When to use Alpine

You may be interested in using Alpine, but find yourself asking, “When should I use it?” Containerized Alpine shines in some key areas:

While there are some other uses for Alpine, most projects will fall under these two categories. Overall, our Alpine container image excels in situations where space savings and security are critical.

How to run Alpine in Docker

Before getting started, download Docker Desktop and then install it. Docker Desktop is built upon Docker Engine and bundles together the Docker CLI, Docker Compose, and other core components. Launching Docker Desktop also lets you use Docker CLI commands (which we’ll get into later). Finally, the included Docker Dashboard will help you visually manage your images and containers.

After completing these steps, you’re ready to Dockerize Alpine!

Note: For Linux users, Docker will still work perfectly fine if you have it installed externally on a server, or through your distro’s package manager. However, Docker Desktop for Linux does save time and effort by bundling all necessary components together — while aiding productivity through its user-friendly GUI.

Use a quick pull command

You’ll have to first pull the Alpine Docker Official Image before using it for your project. The fastest method involves running docker pull alpine from your terminal. This grabs the alpine:latest image (the most current available version) from Docker Hub and downloads it locally on your machine:

Docker desktop ui with list of downloaded images including alpine.

That’s a quick introduction to using the Alpine Official Image alongside Docker Desktop. But it’s important to remember that every Alpine DOI version originates from a Dockerfile . This plain-text file contains instructions that tell Docker how to build an image layer by layer. Check out the Alpine Linux GitHub repository for more Dockerfile examples.

Next up, we’ll cover the significance of these Dockerfiles to Alpine Linux, some CLI-based workflows, and other key information.

Build your Dockerfile

Because Alpine is a standard base for container images, we recommend building on top of it within a Dockerfile . Specify your preferred alpine image tag and add instructions to create this file. Our example takes alpine:3.14 and runs an executable mysql client with it:

FROM alpine:3.14 RUN apk add --no-cache mysql-client ENTRYPOINT ["mysql"]

In this case, we’re starting from a slim base image and adding our mysql-client using Alpine’s standard package manager. Overall, this lets us run commands against our MySQL database from within our application.

Читайте также:  Linux windows загрузчик grub

This is just one of the many ways to get your Alpine DOI up and running. In particular, Alpine is well-suited to server builds. To see this in action, check out Kathleen Juell’s presentation on serving static content with Docker Compose, Next.js, and NGINX. Navigate to timestamp 7:07 within the embedded video.

The Alpine Official Image has a close relationship with other technologies (something that other images lack). Many of our Docker Official Images support -alpine tags. For instance, our earlier example of serving static content leverages the node:16-alpine image as a builder .

This relationship makes Alpine and multi-stage builds an ideal pairing. Since the primary goal of a multi-stage build is to reduce your final image size, we recommend starting with one of the slimmest Docker Official Images.

Grabbing the slimmest possible image

Pulling an -alpine version of a given image typically yields the slimmest result. You can do this using our earlier docker pull [image] command. Or you can create a Dockerfile and specify this image version — while leaving room for customization with added instructions.

In either case, here are some results using a few of our most popular images. You can see how image sizes change with these tags:

Image tag Image size image:[version number]-alpine size
python:3.9.13 867.66 MB 46.71 MB
node:18.8.0 939.71 MB 164.38 MB
nginx:1.23.1 134.51 MB 22.13 MB

We’ve used the :latest tag since this is the default image tag Docker grabs from Docker Hub. As shown above with Python, pulling the -alpine image version reduces its footprint by nearly 95%!

From here, the build process (when working from a Dockerfile ) becomes much faster. Applications based on slimmer images spin up quicker. You’ll also notice that docker pull and various docker run commands execute swifter with -alpine images.

However, remember that you’ll likely have to use this tag with a specified version number for your parent image. Running docker pull python-alpine or docker pull python:latest-alpine won’t work. Docker will alert you that the image isn’t found, the repo doesn’t exist, the command is invalid, or login information is required. This applies to any image.

Get up and running with Alpine today

The Alpine Docker Official Image shines thanks to its simplicity and small size. It’s a fantastic base image — perhaps the most popular amongst Docker users — and offers plenty of room for customization. Alpine is arguably the most user-friendly, containerized Linux distro. We’ve tackled how to use the Alpine Official Image, and showed you how to get the most from it.

Want to use Alpine for your next application or server? Pull the Alpine Official Image today to jumpstart your build process. You can also learn more about supported tags on Docker Hub.

Additional resources

  • Browse the official Alpine Wiki.
  • Learn some Alpine fundamentals via the Alpine newbie Wiki page.
  • Read similar articles about Docker Images.
  • Download and install the latest version of Docker Desktop.

Источник

Оцените статью
Adblock
detector