I am currently writing a docker file that has to be based on alpine (the top line is FROM alpine:latest
. I wish to use tools such as sudo
and curl
(by running a shell script from the dockerfile) which are normally avaialble on linux/mac, and to do this I have tried running RUN apt update && apt-get install sudo -y
- however these don't seem to be available with alpine. Would anyone know how to get apt
after basing off alpine, or another method of obtaining basic tools like sudo and curl? I've tried using apk (e.g. RUN apk add apt-get
) but I always get an error like apt-get (no such package):
.
Asked
Active
Viewed 5,188 times
1

Sabo Boz
- 1,683
- 4
- 13
- 29
1 Answers
6
another method of obtaining basic tools like sudo and curl?
I believe alpine uses apk
instead of apt
Try something like this to install basic tools like curl
and sudo
RUN apk add curl sudo

Tolis Gerodimos
- 3,782
- 2
- 7
- 14
-
this seems to work for sudo and curl, but I also have apt commands like apt-get in the shell script that I want to run, and ```RUN apk add apt-get``` results in ```apt-get (no such package):```, even after running ```RUN apk update``` - would you know how to address this? – Sabo Boz Feb 02 '22 at 18:32
-
1@SaboBoz you can't. `apt` is the package manager of Debian and Debian-based distributions ([ref](https://en.wikipedia.org/wiki/APT_(software))). Alpine uses `apk` as its package manager, not `apt`. – β.εηοιτ.βε Feb 03 '22 at 18:39
-
Related: https://stackoverflow.com/a/53400219/2123530 – β.εηοιτ.βε Feb 03 '22 at 18:41