I am a little lost on how to make container known and reachable to each other.
Let’s say I have:
virtualisation.oci-containers.containers = {
whoami1 = {
image = "docker.io/traefik/whoami:v1.9.0";
ports = [ "127.0.0.1:8001:80" ];
};
whoami2 = {
image = "docker.io/traefik/whoami:v1.9.0";
ports = [ "127.0.0.1:8002:80" ];
};
};
It seems they do share the same network - but there are no names to refer to them:
$ docker cp whoami1:/etc/hosts -
127.0.0.1 localhost
::1 localhost
127.0.0.2 nixos.utm nixos
::1 nixos.utm nixos
10.88.0.1 host.containers.internal host.docker.internal
10.88.0.17 bc5910703e33 whoami1
$ docker cp whoami2:/etc/hosts -
127.0.0.1 localhost
::1 localhost
127.0.0.2 nixos.utm nixos
::1 nixos.utm nixos
10.88.0.1 host.containers.internal host.docker.internal
10.88.0.18 6e53af4729a2 whoami2
I would have hoped for both hosts
files to list all the IPs and container names.
This is when using podman
.
virtualisation = {
containers.enable = true;
oci-containers.backend = "podman";
podman = {
enable = true;
dockerCompat = true;
# defaultNetwork.settings.dns_enabled = true;
};
};