Docker OCI Parameter Passing Incus 6.3

When it comes to networking there is a huge difference between Docker and Incus.

From a high level view Incus instances run in their own network namespace and expose their “local” ports. Let’s say you have them all attached to the default incusbr0 brigde you can reach each individual instance from the host itself but not from outside the host.

To expose these services you can use proxy devices as explained. Now depending on how many instances / services you have it is simple to remember. An alternative solution is having a reverse proxy instance running nginx or apache etc. Create a subdomain or subdirectory foreach of your services and expose only the reverse proxy.

All backend communication between services you just use the internal IP’s or domain names {name}.lxd No need to expose them you rather want to hide them.

Incus is very flexible and requires some more thoughts how to setup your environment. It takes a moment until you see the benefits :wink:

Based on your docker example above a translation to incus would look like the following using command line:

incus init docker:jc21/nginx-proxy-manager:latest nginx-manager                                                
incus config device add nginx-manager letsencrypt storage path=/etc/letsencrypt source=/<somewhere-local>/path/to/nginx-manager/letsencrypt type=disk
incus config device add nginx-manager data storage path=/data source=/<somewhere-local>/path/to/nginx-manager/data type=disk
incus config device add nginx-manager web-81 proxy connect=tcp:127.0.0.1:81 listen=tcp:<host-ip>:8081\n
incus config device add nginx-manager web-80 proxy connect=tcp:127.0.0.1:80 listen=tcp:<host-ip>:8080\n
incus config device add nginx-manager web-443 proxy connect=tcp:127.0.0.1:443 listen=tcp:<host-ip>:8443\n
incus start nginx-manager --console

This configures and would start an Incus OCI container. It mounts the required volumes (in this case using local disk path but can be also incus storage, see docs) and maps the correct ports between your host and instance.
Why I say would start is because there is an issue to start this image, see Incus unable to start/run (docker) container natively: ‘Error: stat /proc/-1: no such file or directory’. I actually just run this in my test lab to verify the exact steps and it won’t start on default execpt you add the workaround to “/init” :wink:

1 Like