Looks like I need a network because I would like to reference one container by hostname from another.
I could also use the --link
but it is deprecated and can disappear soon. That's why I wonder if Testcontainers can create a docker network for me.
With command line I would just execute docker network create bridge2
and then I can start containers like this:
docker run -it --rm --net=bridge2 --name alpine1 alpine
docker run -it --rm --net=bridge2 --name alpine2 alpine
and resolve nslookup alpine2
from alpine1
container.
If I try to use default --net=bridge
network or skip --net
option (which is actually the same) referencing by name will not work.