Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting apt-get on an alpine container

I have to install a few dependencies on my docker container, I want to use python:3.6-alpine version to have it as light as possible, but apk package manager which comes with alpine is giving me trouble so I would like to get the apt-get package manager. I tried:

apk add apt-get 

and it didnt work.

how can I get it on the container?

like image 558
NotSoShabby Avatar asked Nov 20 '18 09:11

NotSoShabby


People also ask

Does Alpine have wget?

For those looking for a HTTP health-check in Alpine images, wget is available from the base image and the health check looks like this.

What is an alpine container?

What is Alpine Linux? Alpine Linux is a Linux distribution built around musl libc and BusyBox. The image is only 5 MB in size and has access to a package repository that is much more complete than other BusyBox based images. This makes Alpine Linux a great image base for utilities and even production applications.


1 Answers

Using multiple package systems is usually a very bad idea, for many reasons. Packages are likely to collide and break and you'll end up with much greater mess than you've started with.
See this excellent answer for more detail: Is there a pitfall of using multiple package managers?

A more feasible approach would be troubleshooting and resolving the issues you are having with apk. apk is designed for simplicity and speed, and should take very little getting used to. It is really an excellent package manager, IMO.

For a good tutorial, I warmly recommend the apk introduction page at the Alpine Wiki site: https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management

If you're determined not to use apk, and for the sake of experiment want try bringing up apt instead, as a first step, you'll have first to build apt from source: https://github.com/Debian/apt. Then, if it is produces a functional build (not likely since it's probably not compatible with musl libc), you'll have to wire it to some repositories, but Alpine repositories are only fit for apk, not apt. As you can see, this is not really feasible, and not the route you want to go to.

like image 156
valiano Avatar answered Sep 23 '22 11:09

valiano