Docker is available in Alpine’s community repository. We will first enable Alpine’s community repositoy and then install Docker.

Enable Alpine community repository

To enable community repositoy in Alpine Linux, we need to edit /etc/apk/repositories file and uncomment the community repo: Open /etc/apk/repositories using a text editor, I am using vim here, you can use nano though.

vim /etc/apk/repositories

Uncomment the line having community word:

#/media/cdrom/apks
http://dl-cdn.alpinelinux.org/alpine/v3.20/main
http://dl-cdn.alpinelinux.org/alpine/v3.20/community

Now run apk update:

apk update

Install Docker:

apk add docker openrc

Add Docker to startup

Now allow Docker to run when system boots:

rc-update add docker

Finally reboot your system:

reboot

Once system is up, you can confirm docker is running:

docker -v