Search code examples
dockercentospowerdns

Dockerfile with centos:latest and pdns


I have a simple Dockerfile using centos:latest which fails to find pdns using yum. This is running on Windows host.

$ docker --version
Docker version 20.10.8, build 3967b7d

Dockerfile_dns

FROM centos:latest

RUN yum update -y

RUN yum install -y epel-release pdns pdns-tools pdns-backend-postgresql pdns-backend-sqlite pdns-recursor net-tools bind-utils jq

Using command
$ docker build -t dns_img -f Dockerfile_dns .

#5 [2/3] RUN yum update -y
#5 sha256:103582845ea3b4ba6361ca1a570ed91dbb7ffbdb7bd1b67e3dc21635f2dfc8da
#5 CACHED

#6 [3/3] RUN yum install -y epel-release pdns pdns-tools pdns-backend-postgresql pdns-backend-sqlite pdns-recursor net-tools bind-utils jq
#6 sha256:6639667b2dcec34132dc4bfb88fe520d625f4ab8de649b631344017f22fbd2d7
#6 2.419 Last metadata expiration check: 0:16:22 ago on Fri Sep 24 16:21:33 2021.
#6 2.788 No match for argument: pdns
#6 2.792 No match for argument: pdns-tools
#6 2.796 No match for argument: pdns-backend-postgresql
#6 2.800 No match for argument: pdns-backend-sqlite
#6 2.804 No match for argument: pdns-recursor
#6 2.817 Error: Unable to find a match: pdns pdns-tools pdns-backend-postgresql pdns-backend-sqlite pdns-recursor
#6 ERROR: executor failed running [/bin/sh -c yum install -y epel-release pdns pdns-tools pdns-backend-postgresql pdns-backend-sqlite pdns-recursor net-tools bind-utils jq]: exit code: 1

I found some references to using a specific centos version, but that didn't help either.


Solution

  • That's because you don't have those dependencies in the repositories you have installed.

    install this repo and you'll have the packages you need:

    RUN yum install epel-release
    

    After you can install your packages:

    RUN yum install -y pdns pdns-tools pdns-backend-postgresql pdns-backend-sqlite pdns-recursor net-tools bind-utils jq
    

    Installing the repo and the dependencies only it holds can't be done because yum executes the installation in one take instead of one after the other like python's pip for example