Some time ago, I asked how I could create a symlink in a stopped container and the method at the time was to use curl
:
curl --unix-socket /var/lib/lxd/unix.socket -s lxd/1.0/containers/mycontainer/files?path=/etc/runlevels/default/firstboot -H "X-LXD-type: symlink" -H "Content-Type: text/plain" -d "/etc/init.d/firstboot"
What’s the Incus equivalent to this command ?
simos
(Simos Xenitellis)
May 15, 2025, 8:42pm
2
Hi!
See here the full REST API for Incus .
First, to check if everything works with curl
, use the following. The output is similar to incus info
.
curl --unix-socket /var/lib/incus/unix.socket incus/1.0 | jq .
You want to create a symbolic link in a container. Use this.
$ curl --silent --unix-socket /var/lib/incus/unix.socket incus/1.0/instances/mycontainer/files?path=/symlink_path -H "X-INCUS-type: symlink" -H "Content-Type: text/plain" -d "/etc/passwd"
{"type":"sync","status":"Success","status_code":200,"operation":"","error_code":0,"error":"","metadata":{}}
$
In summary, from
lxd/1.0/containers/mycontainer/files?
, replace with
incus/1.0/instances/mycontainer/files?
That is,
Use incus
.
Use instances
instead of containers
.
Note that an instance is the name of either a container, a virtual machine, or an application container (i.e. Docker). The API is cleaner when it says instances .
1 Like