Replace resol.conf with resolvconf

Hello
I new to docker. Till now I have created a small debian 9 image using debootstrap.
Further I used the image to start a container.

docker run -it -d --hostname=deb9 --dns=208.67.222.222 debian9:base /bin/bash
docker exec -it “container-id” /bin/bash

Then I try to install resolvconf in order to replace resolv.conf. But I get an error message the resolvconf fails to get configured. resolvconf cannot remove resolv.conf because it is used.
Docker writes the nameserver 208.67.222.222 to resolv.conf. Does Docker need the resolv.conf?

Kind regards, Roland

Docker will set up the entire network ecosystem around your container, before it starts. You don’t need tools to do things like manage /etc/resolv.conf or configure network interfaces; this is all part of the standard Docker container environment.

I’d highly recommend reading Docker’s official tutorial on building and running custom images, and starting from the prebuilt debian image rather than trying to roll your own. (You should rarely need docker exec outside of some initial debugging; it’s distinctly not the way to Do Things With Docker.)

Thanks for your answer.
I know, what I do isn’t the docker way, but it helps me to understand docker. I already read parts of the docker networking docu and other docker howtos (not official).
What I try, is to install openmediavault 4 in my debian 9 container and it fails because of the resolv.conf.

Kind regards, Roland

You shouldn’t “install software in a container”. You really really should build a custom Docker image that contains the software you need, or find a prebuilt image that has it already.

(It sounds like you’re docker run a base image, then docker exec into an interactive shell into that, and now are trying to install stuff; but containers are pretty fragile and you will lose the entire container filesystem if you need to change any container settings or run the software on a different system or Docker’s filesystem setup goes awry. This is not a best practice.)

Reading http://www.openmediavault.org:

It contains services like SSH, (S)FTP, SMB/CIFS, DAAP media server, RSync, BitTorrent client

That’s a lot of things to be running in one container. In a normal Docker setup those would be a half-dozen separate containers. If you need to run this specific bundled software, I’d run it in a virtual machine. (And indeed it sounds like it’s intended to be installed in an “appliance” with full system administration support; that its download page has ISO image links also suggests it is not built in a way that’s compatible with Docker’s model.)

Again. Thank’s for your answer.
It seems, till now I hadn’t really understood the docker concept. I read some information, that docker is going to replace virtual machines, that simulate a whole pc.
Seems I misunderstood something.

Kind regards, Roland