I have a container with alpine image (docker:dind) and I want to install ApparMor inside it to see how it works before I put it on the host.

I found ApparMor package in alpine repostiroy but I don't understand how to install it.

How can I install it and start using it?

On Ubuntu I succeeded with:
apt-get update && apt-get install apparmor-utils

But when I tried on alpine with: apk update && apk add apparmor-utils
It failed:

/ # apk update && apk add apparmor-utils
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
v3.8.2-19-g151c2021d6 [http://dl-cdn.alpinelinux.org/alpine/v3.8/main]
v3.8.2-18-gd7f33f856a [http://dl-cdn.alpinelinux.org/alpine/v3.8/community]
OK: 9546 distinct packages available
ERROR: unsatisfiable constraints:
  apparmor-utils (missing):
    required by: world[apparmor-utils]
  • 1
    Alpine has its own repository, and often names can be a bit different: pkgs.alpinelinux. So looks likeapk add apparmor should do the trick. Side note: looks like this is in the test repository. Most likely you need to add that to /etc/apk/repositories. sudo echo 'http://nl.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories && sudo apk update && sudo info apparmor
    – rowan
    Commented Jan 11, 2019 at 10:22
  • Good practice for test repositories is pinning, check out the documentation here and search for Repository pinning. In this case you won't just upgrade packages that you rather not want from testing. So be aware that I can screw up your installation based on my previous comment where I just echo the repository in without using pinning.
    – rowan
    Commented Jan 11, 2019 at 10:29
  • @rowan I am running the alpine inside a container so I don't care if something will happen. I tried your first suggestion and it failed on info apparmor: sh: appramor: not found
    – E235
    Commented Jan 11, 2019 at 16:42
  • Did you add the repository? I just tested it, and it worked.
    – rowan
    Commented Jan 11, 2019 at 17:25
  • It seems to be installed but the command ` info apparmor` is not working. I noticed I have a new command apparmor_parser. Does it mean that it installed? I thought I need to have a binary named apparmor.
    – E235
    Commented Jan 12, 2019 at 16:00

3 Answers 3


The package apparmor isn't available in the main repository. It can be installed from the testing repository, edge branch :

Add the following line to your /etc/apk/repositories (pinning way):

@edge http://dl-cdn.alpinelinux.org/alpine/edge/testing

Then run:

apk update
apk add apparmor@edge

Alpine Linux: Repository pinning


Thats because the name of the package is apparmor, not apparmor-utils. That "utils" thing at the end of the package name is Ubuntu specific and on Alpine, apparmor-utils is a subpackage.

Try to install the entire apparmor thing with apk update && apk add apparmor.

  • I am still getting the same error. I checked it on labs.play-with-docker.com. I started a container docker run -it alpine and then tried what you wrote.
    – E235
    Commented Jan 11, 2019 at 10:29

Run the below command to install apparmor

apk update
apk add apparmor@edge  --force-broken-world
  • Welcome to the site, and thank you for your contribution. Please note, however, that your approach reiterates mostly what was already described in the accepted answer, save for the --force-broken-world option. You may want to expand your answer to make the significance of that option clearer. If the difference is minor, you may want to submit an edit suggestion to the accepted answer instead.
    – AdminBee
    Commented Sep 6, 2021 at 8:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .