How to Add Packages to an Existing Pi-hole Docker Image?

0
5
Asked By CuriousCoder42 On

I'm trying to install the `apt` package in my existing Pi-hole Docker image, but it doesn't include `apt` or `dpkg`, which means I can't install additional software. I'm wondering if I can reference a Dockerfile from my Docker Compose setup to add and install the necessary packages. My Dockerfile starts off with `FROM debian:latest`, followed by commands to update and try to install `apt`. Here's what I have so far:

```
FROM debian:latest
RUN apt-get update && apt-get install -y apt
RUN apt-get update && apt-get install -y apt && rm -rf /var/lib/apt/lists/*
```

And my Docker Compose setup begins like this:

```
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
ports:
```

Any advice would be greatly appreciated!

3 Answers

Answered By PackagePro On

If you want to install additional packages for functionality in the Pi-hole container, try starting with containers from linuxserver.io. They often support docker-mods which allow you to use existing addons or create your own to extend functionality.

Answered By TechieTom On

The Pi-hole image is actually based on Alpine Linux, which uses `apk` for package management instead of `apt`. So you'll want to switch your approach. You could also consider creating your own Debian/Ubuntu-based Pi-hole image if you prefer using `apt`. That way, you can manage packages as you intend.

Answered By DockerDude85 On

Before making modifications to a running container, think about why you need those changes. Remember, all your modifications will be lost when you pull a new image. What are you trying to achieve? It might be better to find a different solution that doesn't require changing the container.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.