On this page, you can find an explanation of how to create and delete custom images in the Cloud Console.
Table of contents
- SSH Key, that will be specified during creating the Virtual Machine for further connection to them via SSH- it was created with the next parameters:
- Name: testV;
- Public key is placed on the Linux VM during its creation;
- Private Key was copied to the clipboard and saved on the local system in the next text file (for example: ~/.ssh/id_rsa);
- Firewall (Name: for-ssh), that will be specified during creating the Virtual Machine for further connection to it via SSH - it was created with the rule allowing incoming traffic on port 22; this rule was created with the next parameters:
- Description: for connection via ssh;
- Direction: ingress;
- Port range min: 22;
- Port range max: 22;
- Protocol: tcp;
- Remote IP prefix: 0.0.0.0/0
- Ubuntu Virtual Machine (IP: 188.8.131.52), from which we will create custom image - it was created with the next parameters and with additional Firewall named for-ssh, configured to allow incoming traffic on port 22, so we can connect to this Virtual Machine remotely from our local server via SSH:
- Name: testImages;
- Flavor: VC-2;
- Image: ubuntu-server-18.04-LTS-20201111;
- Key pair: testV;
- Networks: public;
- Firewalls: default, for-ssh;
- Volume size: 10.
- API User, created with the following parameters and its RC file has already been loaded:
- Name: testCLIuser;
- Password: P@sword.
For more information on creating and configuring these resources, see the following articles:
Get a list of all available images
To get the list of all available images follow the next steps:
- Loggin to your Ubuntu Virtual Machine - for this we use SSH protocol - to find additional information about, it see the article: Connect to Linux VM via SSH:
ssh -i ~/.ssh/id_rsa firstname.lastname@example.org
- Update Ubuntu package sources by running the following command:
sudo apt update
- Install Kubernetes Python Client by running the next command:
sudo apt install python3-pip
- Install openstack cli tool by running next command one by one:
sudo pip3 install python-openstackclientPlace RC File of the created CLI User to your Virtual Machine:
Сheck that there were indicated the correct OS_USERNAME and OS_PROJECT_ID and press Esc:wq, then Enter to save the changes:
# To use an OpenStack cloud you need to authenticate against the Identity
# service named keystone, which returns a **Token** and **Service Catalog**.
# The catalog contains the endpoints for all services the user/tenant has
# access to - such as Compute, Image Service, Identity, Object Storage, Block
# Storage, and Networking (code-named nova, glance, keystone, swift,
# cinder, and neutron).
# *NOTE*: Using the 3 *Identity API* does not necessarily mean any other
# OpenStack API is version 3. For example, your cloud provider may implement
# Image API v1.1, Block Storage API v2, and Compute API v2.0. OS_AUTH_URL is
# only for the Identity API served through keystone.
# With the addition of Keystone we have standardized on the term **project**
# as the entity that owns the resources.
if [ -z "$OS_USER_DOMAIN_NAME" ]; then unset OS_USER_DOMAIN_NAME; fi
if [ -z "$OS_PROJECT_DOMAIN_ID" ]; then unset OS_PROJECT_DOMAIN_ID; fi
# unset v2.0 items in case set
# In addition to the owning entity (tenant), OpenStack stores the entity
# performing the action as the **user**.
# With Keystone you pass the keystone password.
echo "Please enter your OpenStack Password for project $OS_PROJECT_NAME as user $OS_USERNAME: "
read -sr OS_PASSWORD_INPUT
# If your configuration has multiple regions, we set that information here.
# OS_REGION_NAME is optional and only valid in certain environments.
# Don't leave a blank variable, unset it if it was empty
if [ -z "$OS_REGION_NAME" ]; then unset OS_REGION_NAME; fi
- Execute openrc starting with dot:
- Provide the password of the created CLI User and hit Enter - this password will be used to authenticate you in the Cloud Console.
- Run the next command to get a list of all available images:
openstack image list
In our case the output will be next:
Also all this images you can find in the Cloud Console on the step of creating VMs when you need to an image:
Create/upload an image
To create/upload an image follow the next steps:
- Prepare your own image that you want to upload to the Cloud Console.
In our case, we use just one of the Ubuntu images, but you can upload your own unique image that should be located locally:
- Upload your own unique image, which is already located locally - for this, use the following command:
openstack image create \If the creation was successful, the output will be as follows:
--property os_distro='ubuntu' \
- Make sure that our new image appeared among the available - for this, use the "openstack image list" command:
openstack image list
In our case the output should be the next:
Also you can find this new image in the Cloud Console on the step of creating VMs when you need to select an image:
Let’s take a closer look to the command, that was used for image creating:
openstack image create \
--property os_distro='ubuntu' \
- –disk-format - The supported options are: ami, ari, aki, vhd, vmdk, raw, qcow2, vhdx, vdi, iso, and ploop. The default format is: raw.
- –container-format - The supported options are: ami, ari, aki, bare, docker, ova, ovf. The default format is: bare.
- –file - Upload image from a local file.
- –property - Set a property on this image (repeat for multiple values).
- ubuntu-server-Ventus-Test - New image name.
Also here you can use some other required arguments, for example:
- –location - Download image from an existing URL.
- –copy-from - Copy image from the data store (similar to *--location*).
- –volume - Create an image from a volume.
To find more required arguments use the next command:
openstack image create --help
Delete an image
To delete an image use the next command:
openstack image delete <IMAGE-ID>
If the image, that you want to delete is protected, the first step for deleting is to unprotect it, for this use the next command:
openstack image set --unprotected <IMAGE-ID>