Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install packages in Alpine docker

How do I write Dockerfile commands to install the following in alpine docker image:

  1. software-properties-common
  2. openjdk-8-jdk
  3. python3
  4. nltk
  5. Flask
like image 222
Ankur100 Avatar asked Jan 16 '18 12:01

Ankur100


People also ask

How do I install packages in an alpine image?

You can install packages from a local disk (such as CDROM or a USB stick) or the internet archive location using apk command, the Alpine package manager for binary packages, instead of compiling them from the source. The list of repositories is stored in /etc/apk/repositories configuration file.

Where are packages installed in alpine?

On your local Alpine Linux system, you can find the repositories in the /etc/apk/repositories file, you can use the cat command to view them as follows. Having looked at the repositories, let us straight away jump into managing packages using the apk package manager.

Can you install Docker on alpine?

To install Docker on Alpine Linux, run apk add --update docker openrc. The Docker package is available in the Community repository. Therefore, if apk add fails because of unsatisfiable constraints error, you need to edit the /etc/apk/repositories file to add (or uncomment) a line.

What package manager does alpine use?

apk is the Alpine Package Keeper - the distribution's package manager. It is used to manage the packages (software and otherwise) of the system. It is the primary method for installing additional software, and is available in the apk-tools package.


1 Answers

The equivalent of apt or apt-get in Alpine is apk

A typical Dockerfile will contain, for example:

RUN apk add --no-cache wget 

--no-cache is the equivalent to: apk add wget && rm -rf /var/cache/apk/*

or, before the --no-cache option was available:

RUN apk update && apk add wget 

Alpine rm -rf /var/cache/apk/* has the Debian equivalent rm -rf /var/lib/apt/lists/*.

See the Alpine comparison with other distros for more details.

like image 56
user2915097 Avatar answered Sep 25 '22 12:09

user2915097