Incus: Exploring the Client CLI
Today, we will explore how to use Incus command line client to do basic management of Incus resources. If you need instructions on installing and setting up Incus server for the first time, please refer to my my previous article. So, this article assume that you already have Incus server up and running.
I will try to keep things simple and brief here again, as Incus documentation page offers much more details on how to manage your workloads using the command line client.
In the following sections, I will:
Show you how to install Incus client on a Windows machine
Show you how to run basic commands
Tell you where to learn more about Incus command line client
1. Install Incus Command Line Client
Incus client is the package that allows you to interact with Incus daemon. When you run the command incus --help
, you are actually interacting with Incus client. It takes your commands and then forwards them to the daemon.
Incus client comes preinstalled with Incus server, so you won't need to install it on the machine where you host your containers and virtual machines.
However, if you want Incus server in a different location and Incus client on your workstation, you will need to install and set up the client.
To install Incus command line client on a Windows PC, you can use Chocolatey, Winget, or download the native build from Incus client page.
Installing Incus client using Chocolatey
Make sure you have Chocolatey installed:
Checkout Chocolatey installation page if you don't have it on your Windows computer yet.
Install Incus client:
choco install incus
For installing Incus client using other methods, please check out this page on Incus documentation page.
Once Incus client is installed, you need to connect it to the server to manage the resources..
How to add an Incus server the command line client?
Expose Incus API to the network. On the server, run::
incus config set core.https_address :8443
This commands make Incus API available on your network.
On the server, enter the following command:
incus config trust add <CLIENT_NAME>
Replace client name (
CLIENT_NAME
) with a descriptive name for your client. For examplemy_laptop
.On the client, add the server by running the command:
incus remote add <SERVER_NAME>
Replace the server name (
SERVER_NAME
) with a descriptive name of you Incus server. For examplemy_server_1
. Follow the prompt to add the token given to you by the server.Make sure you properly added you Incus server to the client. Run
incus remote list
to see all the servers your Incus client is connected to.
2. Run Basic Commands using Incus Command Line Client
How to create a new container instance?
To create an Incus container called my-container
, run the following command:
incus launch images:ubuntu/22.04 my-container
By default, the command incus launch
creates a system container. If you want a full virtual machine, you can use the --vm
flag (incus launch images:ubuntu/22.04 my-virtual-machine --vm
). There are more options available when creating a new instance, but we will not cover all of them today.
Stopping or deleting an instance is simple with incus stop my-container
and incus delete my-container
. To learn more about what you can do with Incus command line client, please visit the official documentation of Incus..
3. Where to Go from Here
Incus project: https://github.com/zabbly/incus
Incus home page: https://linuxcontainers.org/incus/introduction/
Incus documentation: https://linuxcontainers.org/incus/docs/main/
Conclusion
Today, I wanted to introduce Incus command line client and show you how to install it on your machine. Incus client is supported on major operating systems, including macOS and Windows.
Just a quick reminder, Incus client comes with Incus server installation. This means you don't have to install the client separately on your server. You only need to install Incus client yourself if you want to manage your resources from a computer other than the one where you installed Incus server. After installing the command line client, expose Incus API to your network, add the server to the client, and you'll be ready to do some cool stuff..
Subscribe to my newsletter
Read articles from Mamadou Sandwidi directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by