/
DirectorySecurity Advisories
Sign In
Directory
chainguard-base logo

chainguard-base

Last changed

Create your Free Account

Be the first to hear about exciting product updates, critical vulnerability alerts, compare alternative images, and more.

Sign Up
Versions
Overview
Provenance
Specifications
SBOM
Vulnerabilities
Advisories

Chainguard Container for chainguard-base

Minimal image useful as a base for building secure images.

Chainguard Containers are regularly-updated, secure-by-default container images.

Download this Container Image

For those with access, this container image is available on cgr.dev:

docker pull cgr.dev/ORGANIZATION/chainguard-base:latest

Be sure to replace the ORGANIZATION placeholder with the name used for your organization's private repository within the Chainguard Registry.

Compatibility Notes

chainguard-base is comparable to other common base images, like alpine, debian, or ubuntu, with the following differences:

  • Like all other Chainguard Images, chainguard-base features a stripped down, minimal design
  • This base image comes with apk and BusyBox and reports as being a Chainguard image.
  • It has few-to-zero CVEs
  • It does not run as the root user

Getting Started

The chainguard-base image includes a shell and package manager, making it useful for installing an application’s OS-level dependencies. The image will start in a shell by default:

docker run -it cgr.dev/ORGANIZATION/chainguard-base
30d670f520ad:/#

You can run commands from within the shell like this, or you can run commands directly on your local machine without opening a shell:

docker run cgr.dev/ORGANIZATION/chainguard-base ps
PID   USER 	TIME  COMMAND
	1 root  	0:00 ps

This image is commonly used in Dockerfiles, as in the following example:

FROM cgr.dev/ORGANIZATION/chainguard-base

RUN apk update && apk add redis

ENTRYPOINT ["/usr/bin/redis-server"]

This example Dockerfile will update apk and install the Redis server onto the base image.

You could use a Dockerfile like this to build a new image:

docker build -t myredis --progress plain --no-cache .
#0 building with "default" instance using docker driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 152B done
#1 DONE 0.0s

#2 [internal] load metadata for cgr.dev/chainguard.edu/chainguard-base:latest
#2 DONE 0.0s

#3 [internal] load .dockerignore
#3 transferring context: 2B done
#3 DONE 0.0s

#4 [1/2] FROM cgr.dev/chainguard.edu/chainguard-base:latest
#4 DONE 0.0s

#5 [2/2] RUN apk update && apk add redis
#5 0.111 fetch https://packages.cgr.dev/extras/x86_64/APKINDEX.tar.gz
#5 5.625 fetch https://packages.wolfi.dev/os/x86_64/APKINDEX.tar.gz
#5 6.824  [https://packages.cgr.dev/extras]
#5 6.824  [https://packages.wolfi.dev/os]
#5 6.824 OK: 87589 distinct packages available
#5 7.139 (1/5) Installing ncurses-terminfo-base (6.5_p20240629-r0)
#5 7.294 (2/5) Installing ncurses (6.5_p20240629-r0)
#5 7.515 (3/5) Installing bash (5.2.37-r1)
#5 7.746 (4/5) Installing posix-libc-utils (2.40-r2)
#5 7.911 (5/5) Installing redis-7.4 (7.4.1-r0)
#5 8.346 OK: 22 MiB in 20 packages
#5 DONE 8.4s

#6 exporting to image
#6 exporting layers 0.0s done
#6 writing image sha256:f7b9c568bce1a0eedc04ed5ee56b3e20669c9d7b2f544d396dff5dd247745a50 done
#6 naming to docker.io/library/myredis2 done
#6 DONE 0.1s

Following that, you can run the new image built from the chainguard-base image.

docker run myredis

Configuration

The chainguard-base image uses the ash shell from BusyBox by default.

If you need to port a bash and Debian centric entrypoint script to Chainguard Images, you can update your scripts to work in ash. Alternatively, you can install the shell that works with your scripts.

For example:

docker run -it cgr.dev/ORGANIZATION/chainguard-base
e9804f9b1ca9:/# echo {1..5}
{1..5}

e9804f9b1ca9:/# apk add bash
fetch https://packages.wolfi.dev/os/aarch64/APKINDEX.tar.gz
(1/3) Installing ncurses-terminfo-base (6.4_p20231125-r1)
(2/3) Installing ncurses (6.4_p20231125-r1)
(3/3) Installing bash (5.2.21-r1)
OK: 20 MiB in 17 packages

e9804f9b1ca9:/# bash

e9804f9b1ca9:/# echo {1..5}
1 2 3 4 5

e9804f9b1ca9:/#

Oftentimes, you’ll often need to install extra utilities to provide required dependencies for applications and scripts. These dependencies are likely to have different package names compared to other Linux distributions, so the apk search command can be very useful for finding the package you need.

For example, say you are porting a Dockerfile that uses the groupadd command. You could convert this to the BusyBox addgroup equivalent, but it’s also perfectly fine to add the groupadd utility. The only issue is that there’s no groupadd package, so you will have to search for it:

e9804f9b1ca9:/# groupadd
/bin/sh: groupadd: not found

e9804f9b1ca9:/# apk add groupadd
ERROR: unable to select packages:
  groupadd (no such package):
	required by: world[groupadd]

e9804f9b1ca9:/# apk update
fetch https://packages.cgr.dev/extras/x86_64/APKINDEX.tar.gz
fetch https://packages.wolfi.dev/os/x86_64/APKINDEX.tar.gz
 [https://packages.cgr.dev/extras]
 [https://packages.wolfi.dev/os]

e9804f9b1ca9:/# apk search groupadd
shadow-4.15.1-r0

e9804f9b1ca9:/# apk add shadow
(1/4) Installing libmd (1.1.0-r1)
(2/4) Installing libbsd (0.12.2-r0)
(3/4) Installing linux-pam (1.6.1-r0)
(4/4) Installing shadow (4.15.1-r0)
OK: 20 MiB in 18 packages

e9804f9b1ca9:/# groupadd
Usage: groupadd [options] GROUP

Options:
  -f, --force               	exit successfully if the group already exists,
                            	and cancel -g if the GID is already used
  -g, --gid GID             	use GID for the new group
  -h, --help                	display this help message and exit
  -K, --key KEY=VALUE       	override /etc/login.defs defaults
  -o, --non-unique          	allow to create groups with duplicate
                            	(non-unique) GID
  -p, --password PASSWORD   	use this encrypted password for the new group
  -r, --system              	create a system account
  -R, --root CHROOT_DIR     	directory to chroot into
  -P, --prefix PREFIX_DIR   	directory prefix
  -U, --users USERS         	list of user members of this group

Another useful trick is the cmd: syntax for finding packages that provide commands. For example, searching for ldd returns multiple results:

e9804f9b1ca9:/# apk search ldd
dpkg-dev-1.22.6-r0
nfs-utils-2.6.4-r1
posix-libc-utils-2.39-r1

But if you use the cmd: syntax it will only return a single result:

e9804f9b1ca9:/# apk search cmd:ldd
posix-libc-utils-2.39-r1

You can even use the syntax directly in apk add:

e9804f9b1ca9:/# apk add cmd:ldd
(1/4) Installing ncurses-terminfo-base (6.4_p20231125-r1)
(2/4) Installing ncurses (6.4_p20231125-r1)
(3/4) Installing bash (5.2.21-r1)
(4/4) Installing posix-libc-utils (2.39-r1)
OK: 27 MiB in 22 packages

Documentation and Resources

The following resources provide helpful information on working with Chainguard's base images. Note that some of these resources focus on the wolfi-base image — the free-tier alternative to the chainguard-base image — but these same principles and practices apply to chainguard-base.

What are Chainguard Containers?

Chainguard Containers are minimal container images that are secure by default.

In many cases, the Chainguard Containers tagged as :latest contain only an open-source application and its runtime dependencies. These minimal container images typically do not contain a shell or package manager. Chainguard Containers are built with Wolfi, our Linux undistro designed to produce container images that meet the requirements of a more secure software supply chain.

The main features of Chainguard Containers include:

For cases where you need container images with shells and package managers to build or debug, most Chainguard Containers come paired with a -dev variant.

Although the -dev container image variants have similar security features as their more minimal versions, they feature additional software that is typically not necessary in production environments. We recommend using multi-stage builds to leverage the -dev variants, copying application artifacts into a final minimal container that offers a reduced attack surface that won’t allow package installations or logins.

Learn More

To better understand how to work with Chainguard Containers, please visit Chainguard Academy and Chainguard Courses.

In addition to Containers, Chainguard offers VMs and Libraries. Contact Chainguard to access additional products.

Trademarks

This software listing is packaged by Chainguard. The trademarks set forth in this offering are owned by their respective companies, and use of them does not imply any affiliation, sponsorship, or endorsement by such companies.

Licenses

Chainguard container images contain software packages that are direct or transitive dependencies. The following licenses were found in the "latest" version of this image:

  • Apache-2.0

  • GCC-exception-3.1

  • GPL-2.0-only

  • GPL-2.0-or-later

  • GPL-3.0-or-later

  • LGPL-2.1-or-later

  • MIT

For a complete list of licenses, please refer to this Image's SBOM.

Software license agreement

Compliance

A FIPS validated version of this image is available for FedRAMP compliance. STIG is included with FIPS image.


Related images

Category
base

Safe Source for Open Sourceâ„¢
Media KitContact Us
© 2025 Chainguard. All Rights Reserved.
Private PolicyTerms of Use

Products

Chainguard ContainersChainguard LibrariesChainguard VMs