I was wondering if someone could shed some light on the issue im having,
Currently i have my VM working with various dockers with no issue, But in that virtual machine i have a samba container which uses ports like 88 for kerberos and 53 for DNS and its working fine.
The question is that for me not to create another VM because i cannot have the same ports working on the same network card, would it be possible to add another physical NIC and bind to the docker container and add another container with port 88 and 53 for the second NIC?
When you publish a container port to a host, by default (when -p host-port:container-port is used) it will bind to 0.0.0.0. It is possible to specify the ip to bind to: -p existing-host-ip:host-port:container-port (note: this feature is not supported on swarm service deployments)
Furthermore, you could leverage a macvlan network to have ips from the host lan. macvlan has been discussed plenty of times in the forum, and there are plenty of blog posts covering the topic.
brctl show
bridge name bridge id STP enabled interfaces
br-522110d958b1 8000.02421cca33f7 no veth2799371
veth65bd2f5
veth810f056
br-cdf878e0c41e 8000.024226ab1d40 no
br-f420e4a6a522 8000.0242920601a9 no veth3aefb4d
veth713f76c
vethcba144e
br1 8000.0242d3e21cd1 no vethd877dfe
docker0 8000.02425a51970f no veth8a70b5d
but after that not sure how i can incorporate it on a docker compose? i have something like this an example
You either create your network by using docker network create and refer to in your compose file as external: true or you declare the network completely in the compose file without external: true.
For macvlan networks, it is important that the network does not have a dhcp server, otherwise you need to specify --ip-range with a cidr range withing the subnet that is not handled by dhcp.
Even though this seems to be not a problem for you yet, it is still good to know: security features of the linux kernel prevent direct communication between the macvlan parent interface (=host interfaces) and the macvlan child interfaces (=container interfaces). Hosts in the subnet, or hosts routed from other subnets can access the macvlan child interfaces.
Uhm, very much like the complete example I shared in an earlier post:
Of couse you need to modify the example to use your network name inside the compose file and the name it has external, like you did in your last post.
Note: networks (and volumes) are immutable objects - even if they are managed in a compose file, changes will not be applied to them. Once they are removed (docker network rm, docker volume rm), they can be re-created by compose with the current configuration.