How to use custom image in containers

This post includes some information on how to do it

The relevent part of the config file is (as an example):

Install apt repos and packages needed for docker
    apt:
      preserve_sources_list: true
      sources:
        docker.list:
          source: deb [arch=amd64] https://download.docker.com/linux/debian $RELEASE stable
          keyid: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
          filename: docker.list
        nvidia-container-toolkit.list:
          source: deb https://nvidia.github.io/libnvidia-container/stable/deb/$(ARCH) /
          keyid: C95B321B61E88C1809C4F759DDCAE044F796ECB0
          filename: nvidia-container-toolkit.list
    packages:
      - apt-transport-https
      - apt-utils
      - ca-certificates
      - curl
      - gpg
      - docker-ce
      - docker-ce-cli
      - containerd.io
      - docker-buildx-plugin
      - docker-compose-plugin
      - nvidia-container-toolkit

Edit:
your workflow would most likely be to create the container, stop it after it’s installed.
Edit the config file with

sudo incus config edit <contairnename>

and add the packages you want to be installed, and then start the container again.