How do I communicate my instances betwheen them?

Hi, I discovered incus recently and I really like it.

I’m testing the communicate between instances, but I can’t to communicate the microservices betwheen they

I testing 2 instances first (ub1, ub2).

in ub1 I have a server run in port 80, but from ub2 i don’t connected

(venv) root@ub1:~# uvicorn handler:app --port 80
INFO:     Started server process [3404]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on (Press CTRL+C to quit)

from the ub2

root@ub2:~# curl ub1
curl: (6) Could not resolve host: ub1
root@ub2:~# curl
curl: (7) Failed to connect to port 80 after 0 ms: Connection refused

Thanks for your advices :slight_smile:

$ incus profile show default
config: {}
description: Default Incus profile
    name: eth0
    network: incusbr0
    type: nic
    path: /
    pool: default
    type: disk
name: default
- /1.0/instances/ub1
- /1.0/instances/ub2

$ incus network show incusbr0

  ipv4.firewall: "true"
  ipv4.nat: "true"
  ipv6.address: fd42:666:da7d:9096::1/64
  ipv6.nat: "true"
  security.acls.default.ingress.action: allow
description: ""
name: incusbr0
type: bridge
- /1.0/instances/ub1
- /1.0/instances/ub2
- /1.0/profiles/default
managed: true
status: Created
- none


When you run a network service in an instance, this service may bind/listen to a specific interface only. Here it says that it listens only on loopback (, meaning that this network service is not readily accessible from other instances.

You would need to get each network service to listen to the Incus private network (typically eth0).
Then, they will be accessible even using the build-in hostnames, like ub2.incus. Those hostnames are available to instances and they can address each other with those names.

thanks @simos !

then, how can do get each instences listen the incus private network? i know that is more safe.

That should be a configuration option with the software you are trying. Just like you specify the port, you can specify the interface to listen on.

The option should be host. You can specify it in the configuration file of Uvicorn, or in the command line.

If you set the host to, that is a special value, and it means that the service should bind/listen to all network interfaces, including your incusbr0 network interface.

In this question at python - FastAPI/uvicorn not working when specifying host - Stack Overflow there is a similar query. Initially in that question there is a bit of confusion· is a symbolic value and not an actual IP address.

thanks @simos, the solutions in uvicorn is run as

uvicorn file:object --port port --host=instance.incus

in my case

uvicorn handler:app --port 81 --host ub1.incus
1 Like