Trying to Dockerize Mail-in-a-box

Hey Guys,
I need to run multiple server parralel and got a single powerful host.I try make a docker container for my mailserver, but it changes a lot on a regular clean ubuntu server image.I need and want to seperate my services with low ressources consumption. I tried to make it myself but the ubuntu image lacks even with the needed packages in interpreting python in runtime (I have no clue of python programming). I hope someone of you awesome guys can help me with knowledge.

My approach:

Starting a suitable docker container:

docker run -d -p 25:25 -p 443:443 -p 80:80 -p 993:993 -p:465:465 -p 587:587 -h "lol.org" --ip "myipv4" --ip6 "myipv6" -ti --restart=always --name=miab_test ubuntu

Commandes inside the Container:

apt-get upgrade -y
apt-get install wget sudo curl systemd lsb-core fail2ban nano python-pip netcat-openbsd sed bind9-host locales (ufw) -y
locale-gen en_US.UTF-8
apt-get purge vim* -y
pip install utils
pip install sqlite3
pip3 install "email_validator==0.1.0-rc4"
curl -s https://mailinabox.email/setup.sh | sudo -E bash

Current problems:

  • The installer script tries to install change the hostname even when I preconfigure it -> How to fool the docker container that it can change the hostname ?
  • python does not good resolve the folder paths to the following installing scripts for the single parts of the mailserver (postfix,roundcube,dovecut,…) -> Is there anything special to consider when installing python on ubuntu image?

Notes:

  • The Server needs access to these port to function
  • The installer script of the maintainer only supports ubuntu
  • I needed to pass my ip adresses in order to make it for the installation script detectable
  • I set also a fix hostname for easier installation so i dont need to make there changes in the script

I am very sorry that this is a sooo long post but i am desperate in finding a solution and many other forums considerd my request as off-topic and in the forum of the maintainer there is no guy with at least some knowledge.

You might want to make yourself aquianted with Dockerfiles, write a Dockerfile that encapsulates all your commands and actualy use it to create a docker image. Then use your docker image to create the containers.

A docker container is NOT a vm. A container is an isolated process (sometimes with additional subprocesses) running on the host’s kernel,