Are you still loooking for an answer?
Normally we don’t want our Dockerfile to depend on the host and I can’t imagine many scenarios where it is required. But of course if you have that kind of scenario, then it doesn’t matter because you want a solution and not a Dockerfile which blindly follow the rules. But the one thing I don’t understand, what is host specific part of the Dockerfile here? Do you mean you have to configure the Active Directory on the host? That would be just a requirement for the Docker container to use.
My problem is that your issue for me is too theoretical. Maybe because I don’t know samba well enough but I try to summarize some thoughts:
- Include everything you can in a Docker image.
- Avoid using Docker images that required to be rebuilt on each host.
- Don’t be afraid of rebuilding the Docker image on each host if you have no other choice. Docker is just a tool and not the goal.
- Always use a Dockerfile
- You are allowed to generate the Dockerfile dynamically
- Even if you generate the Dockerfile, always use a version controlled script to do that. This is how I create my PHP images for different versions. In addition to that I also version controll the generated files.
- You can have prerequisites but make sure you define them clear enough in a readme or a documentation. If you have scripts to meet those requirements that’s even better.
- Always have a default base configuration which can have some required paramaters but don’t rely on anything that is not under your control. Any wizard on the host can suddenly work differently and the user can’t even try the container
- If you don’t know how the final configuration should look like, then yes, you use those wizards to create a default configuration with some placeholders and copy it into the Dockerfile. When the container starts you can replace the placeholders based on environment variables (or secrets) from your entrypoint or default command.
I hope I could give you some useful tips or at least your topic will appear again on the home page for others to see it.