Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Purpose

This is a guide to migrate Debian's apt package management commands to Alpine's apk commands.

Software packages for Alpine Linux are digitally signed tar.gz archives that contain binaries, configuration files and dependency metadata. Packages, sometimes called "a-packs" use the extension .apk.

How to use this guide

Use this guide to translate Debian apt-get commands to Alpine apk commands used within a Dockerfile.

Because this guide focuses on Dockerfiles, it only covers a selected subset of all apk commands. Readers interested in learning more about apk should read Alpine's package management guide.

The following table contains the mapping from apt commands to apk commands.

...

Actionapt commandapk command

Update package database

apt-get update

apk update

Install packages

apt-get install package1 package2
apk add package1 package2

...

Filter by label (Content by label)
showLabelsfalse
max5
spacesDW
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel = "kb-how-to-article" and type = "page" and space = "DW"
labelskb-how-to-article

...

hiddentrue

...

Remove packages

apt-get remove package1 package2
apk del package1 package2

Download packages

apt-get install --download-only package1 package2
apk fetch package1 package2

Clean up downloaded packages

apt-get clean

Alpine cleans up packages automatically.


Learning more about apk

The fastest to learn about apk is to use it within a Docker container.

$ docker pull alpine

$ docker run -ti alpine

You will get Alpine's shell prompt. To get detailed information on options and sub-commands, execute:

#apk --help --verbose