Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use apt/sudo in alpine-based docker image

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):.

like image 744
Sabo Boz Avatar asked Jun 01 '26 15:06

Sabo Boz


1 Answers

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
like image 104
Tolis Gerodimos Avatar answered Jun 04 '26 12:06

Tolis Gerodimos