Finding FreeBSD Images in Oracle Cloud
Tuesday, 19 Nov 2024
Now that FreeBSD is available in the Oracle Cloud Marketplace, we want to
make it easy for you to find the images you need for your projects. We
obviously will be using the command line, so you’ll need a FreeBSD system
withdevel/oci-cli
installed, and the appropriate config files locally.
First up, let’s list all the Operating System listings that have been
tagged FreeBSD
. There’s an expectoration of JSON, but within that we
really only care about the “id” field, which we’ll use in the next step.
$ oci marketplace listing list --name FreeBSD --all
{
"data": [
{
"categories": [
"Operating Systems"
],
"compatible-architectures": [
"X86",
"ARM"
],
"icon": {
"content-url": "https://cloud.oracle.com/plugins/pacman-prod-consumer-content/176797756.png",
"file-extension": "png",
"mime-type": "image/png",
"name": ""
},
"id": "125980175", <--- this is the id we need
"is-featured": false,
"is-rover-exportable": false,
"listing-type": "PARTNER",
"name": "FreeBSD",
"package-type": "IMAGE",
"pricing-types": [
"FREE"
],
"publisher": {
"description": "The FreeBSD Foundation is a non-profit organization
that helps develop and supports the open source FreeBSD operating system.",
"id": "124619329",
"name": "The FreeBSD Foundation"
},
"regions": null,
"short-description": "FreeBSD",
"supported-operating-systems": null,
"tagline": "FreeBSD is an operating system used to power modern servers, desktops, and embedded platforms."
}
]
}
In future there will be more than one listing. The intent is to have two, one that carries only RELEASE versions, and another one, called CURRENT, that will have frequently-updated STABLE and CURRENT versions, for those who like it fresh and tasty, with the occasional crunchy bits.
Now that we have the listing ID, we can list the actual images available, that match the FreeBSD version we’re interested in:
$ oci marketplace package list --all --output table \
--listing-id 125980175 \
--query 'data[?contains("package-version",\'14.2\')]'
+------------+--------------+------------------------------+---------+---------+-------------+---------------------------+
| listing-id | package-type | package-version | pricing | regions | resource-id | time-created |
+------------+--------------+------------------------------+---------+---------+-------------+---------------------------+
| 125980175 | IMAGE | FreeBSD-14.2-BETA2-arm64-zfs | None | None | 177023147 | 2024-11-14T00:00:00+00:00 |
| 125980175 | IMAGE | FreeBSD-14.2-BETA2-arm64-ufs | None | None | 177023231 | 2024-11-14T00:00:00+00:00 |
| 125980175 | IMAGE | FreeBSD-14.2-BETA2-amd64-zfs | None | None | 177023078 | 2024-11-14T00:00:00+00:00 |
| 125980175 | IMAGE | FreeBSD-14.2-BETA2-amd64-ufs | None | None | 177022899 | 2024-11-14T00:00:00+00:00 |
+------------+--------------+------------------------------+---------+---------+-------------+---------------------------+
$ oci marketplace package list --all --output table \
--listing-id 125980175 \
--query 'data[?contains("package-version",\'14.2\')]["package-version","resource-id"]'
+------------------------------+-----------+
| Column1 | Column2 |
+------------------------------+-----------+
| FreeBSD-14.2-BETA2-arm64-zfs | 177023147 |
| FreeBSD-14.2-BETA2-arm64-ufs | 177023231 |
| FreeBSD-14.2-BETA2-amd64-zfs | 177023078 |
| FreeBSD-14.2-BETA2-amd64-ufs | 177022899 |
+------------------------------+-----------+
...
Now for the weird part - the `resource-id` is not the OCID of the image,
so we need to convert it to the actual OCID: