Docker Community Forums

Share and learn in the Docker community.

Samba - Change ip in docker container or change DNS entries?


(Waishon) #1

Hey there,

I’m currently building a samba docker image which starts a Samba Active Directory Domain Controller.
That’s working pretty fine and I’m able to access the LDAP and login using the smbclient tool.

But there’s one problem:
The docker container gets the IP, so the Samba build in DNS server set’s the required records to “” which results into errors when client’s try to join the DC because they cant reach the DC in the scope of

So there’re two options:
1. I need to teach the samba server to provide the IP address of the host computer, where the docker containers are running in, to the clients. This is only possible when I change the DNS entries of the build in DNS server. But this seems to be a hacky solution and I don’t know if it’s destroys something in the internal process of the Samba DC.
So I’d like to use option 2.
2. What would be the best solution using docker? I need to assign the docker container an IP from the range of and it should be able to communicate with the external network.
I saw that there’s the “host” option available for networking, but then it forwards all network interfaces to the container, which results into an DNS records containing all IPs of all available network interfaces.
The best would be to create another interface like eth0:1 assigns it an IP and forwards only this to the samba docker in the same way as the --network=host option. Is this possible to do? If not, do you’ve another idea?

P.S. I’d like to use docker because of the great way to create an image of a service and the ability to move it to other servers without configuring everything new.