Convert Figma logo to code with AI

gliderlabs logodocker-alpine

Alpine Linux Docker image. Win at minimalism!

5,710
529
5,710
123

Top Related Projects

Official Alpine Linux Docker image. Win at minimalism!

Minimal Node.js Docker Images built on Alpine Linux

Quick Overview

The gliderlabs/docker-alpine repository is a project that provides a minimal Docker image based on Alpine Linux. It serves as a base image for building lightweight containers, offering a small footprint and security-focused design. This project is widely used in the Docker community for creating efficient and secure containerized applications.

Pros

  • Extremely small image size, typically under 5MB
  • Regularly updated with security patches and improvements
  • Well-documented and maintained by an active community
  • Provides a solid foundation for building minimal, secure Docker images

Cons

  • Limited package availability compared to larger distributions
  • May require additional configuration for complex applications
  • Some applications may not be compatible with Alpine's musl libc
  • Learning curve for developers used to more feature-rich distributions

Getting Started

To use the Alpine Linux Docker image, you can start with the following Dockerfile:

FROM alpine:latest

RUN apk add --no-cache python3 py3-pip

WORKDIR /app

COPY requirements.txt .
RUN pip3 install -r requirements.txt

COPY . .

CMD ["python3", "app.py"]

To build and run the Docker image:

docker build -t my-alpine-app .
docker run -it --rm my-alpine-app

For more advanced usage and configuration options, refer to the official documentation in the gliderlabs/docker-alpine repository.

Competitor Comparisons

Official Alpine Linux Docker image. Win at minimalism!

Pros of docker-alpine

  • Official repository maintained by the Alpine Linux team
  • More frequent updates and releases
  • Broader range of supported architectures

Cons of docker-alpine

  • Less community engagement and contributions
  • Fewer additional tools and scripts included
  • Less detailed documentation for Docker-specific use cases

Code Comparison

docker-alpine:

FROM scratch
ADD alpine-minirootfs-3.14.0-x86_64.tar.gz /
CMD ["/bin/sh"]

docker-alpine:

FROM scratch
ADD rootfs.tar.gz /
CMD ["/bin/sh"]

Both repositories provide minimal Alpine Linux Docker images, but their approaches differ slightly. The docker-alpine repository focuses on providing official, up-to-date Alpine Linux images with a wider range of supported architectures. However, it may lack some of the community-driven enhancements and Docker-specific optimizations found in docker-alpine.

docker-alpine benefits from community contributions and includes additional tools and scripts that can be helpful for Docker users. It also offers more detailed documentation tailored to Docker use cases. However, it may not receive updates as frequently as the official Alpine Linux repository.

When choosing between the two, consider factors such as update frequency, architecture support, and the need for additional Docker-specific tools and documentation.

Minimal Node.js Docker Images built on Alpine Linux

Pros of alpine-node

  • Pre-installed Node.js, saving setup time for Node.js projects
  • Multiple Node.js versions available, allowing flexibility for different project requirements
  • Includes npm and yarn package managers, streamlining dependency management

Cons of alpine-node

  • Larger image size due to Node.js and package managers
  • More specific use case, less versatile for non-Node.js projects
  • Potentially more security vulnerabilities due to additional software

Code comparison

docker-alpine:

FROM alpine:3.14
RUN apk add --no-cache ca-certificates

alpine-node:

FROM alpine:3.14
ENV NODE_VERSION 16.13.0
RUN apk add --no-cache nodejs npm yarn

The docker-alpine Dockerfile is simpler, focusing on providing a minimal Alpine Linux base image. The alpine-node Dockerfile adds Node.js, npm, and yarn to the base image, making it ready for Node.js development out of the box.

docker-alpine serves as a lightweight base for various applications, while alpine-node is tailored specifically for Node.js projects. The choice between them depends on the project requirements and whether Node.js is needed in the container environment.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

docker-alpine

CircleCI Docker Stars Docker Pulls Slack

A super small Docker image based on Alpine Linux. The image is only 5 MB and has access to a package repository that is much more complete than other BusyBox based images.

Why?

Docker images today are big. Usually much larger than they need to be. There are a lot of ways to make them smaller, but the Docker populace still jumps to the ubuntu base image for most projects. The size savings over ubuntu and other bases are huge:

REPOSITORY          TAG           IMAGE ID          VIRTUAL SIZE
gliderlabs/alpine   latest        9cfff538e583      4.803 MB
debian              latest        19134a8202e7      123.1 MB
ubuntu              latest        104bec311bcd      129 MB
centos              latest        67591570dd29      191.8 MB

There are images such as progrium/busybox which get us very close to a minimal container and package system. But these particular BusyBox builds piggyback on the OpenWRT package index which is often lacking and not tailored towards generic everyday applications. Alpine Linux has a much more complete and up to date package index:

$ docker run progrium/busybox opkg-install nodejs
Unknown package 'nodejs'.
Collected errors:
* opkg_install_cmd: Cannot install package nodejs.

$ docker run gliderlabs/alpine apk add --no-cache nodejs
fetch http://alpine.gliderlabs.com/alpine/v3.3/main/x86_64/APKINDEX.tar.gz
fetch http://alpine.gliderlabs.com/alpine/v3.3/community/x86_64/APKINDEX.tar.gz
(1/4) Installing libgcc (5.3.0-r0)
(2/4) Installing libstdc++ (5.3.0-r0)
(3/4) Installing libuv (1.7.5-r0)
(4/4) Installing nodejs (4.2.3-r0)
Executing busybox-1.24.1-r7.trigger
OK: 29 MiB in 15 packages

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.

Usage

Stop doing this:

FROM ubuntu-debootstrap:14.04
RUN apt-get update -q \
  && DEBIAN_FRONTEND=noninteractive apt-get install -qy mysql-client \
  && apt-get clean \
  && rm -rf /var/lib/apt
ENTRYPOINT ["mysql"]

This took 19 seconds to build and yields a 164 MB image. Eww. Start doing this:

FROM gliderlabs/alpine:3.4
RUN apk add --no-cache mysql-client
ENTRYPOINT ["mysql"]

Only 3 seconds to build and results in a 36 MB image! Hooray!

Documentation

This image is well documented. Check out the documentation at Viewdocs and the docs directory in this repository.

Contacts

We make reasonable efforts to support our work and are always happy to chat. Join us in our Slack community or submit a GitHub issue if you have a security or other general question about this Docker image. Please email security or user mailing lists if you have concerns specific to Alpine Linux.

Inspiration

The motivation for this project and modifications to mkimage.sh are highly inspired by Eivind Uggedal (uggedal) and Luis Lavena (luislavena). They have made great strides in getting Alpine Linux running as a Docker container. Check out their mini-container/base image as well.

Sponsors

Fastly

Fastly provides the CDN for our Alpine Linux package repository. This allows super speedy package downloads from all over the globe!

License

The code in this repository, unless otherwise noted, is BSD licensed. See the LICENSE file in this repository.