Skip to content

Sharing your own images

Images can be shared between projects on the current release of OpenStack. If an image had been uploaded to your currently active project, you can then use the openstack image add project operations to share that image with another project.

For example, to share an image, first source the project profile for the project containing the image you want to share and :

Make sure the visibility of the image is shared:

openstack image set --shared 'CentOS 8 GenericCloud'

Then share it to the project you wanted

In this example the target project id is 75188656561447879dda2f4a2653e939

$ openstack image add project 'CentOS 8 GenericCloud' 75188656561447879dda2f4a2653e939
| Field      | Value                                |
| created_at | 2021-02-26T13:30:05Z                 |
| image_id   | 69112d12-0acb-4321-bbc6-f2d493ab6be3 |
| member_id  | 75188656561447879dda2f4a2653e939     |
| schema     | /v2/schemas/member                   |
| status     | pending                              |
| updated_at | 2021-02-26T13:30:05Z                 |

At this point a member of the target project 75188656561447879dda2f4a2653e939 needs to accept the image in order to be available in the images list. Please make sure that the image id specified corresponds to the image you are sharing in this case 69112d12-0acb-4321-bbc6-f2d493ab6be3.

openstack image set --accept 69112d12-0acb-4321-bbc6-f2d493ab6be3

You should then have the image visible in the target project's image list.

$ openstack image list
| ID                                   | Name                                          | Status |
| 69112d12-0acb-4321-bbc6-f2d493ab6be3 | CentOS 8 GenericCloud                         | active |
| 097480e6-16bc-4a50-a7af-e34399d039ac | cirros-0.3.4                                  | active |
| 735a5c16-56f0-4c15-80e7-49056dbc4f71 | Debian 10.10 buster                           | active |
| 49f425ed-bf79-46ab-8cf3-44935d9d831e | Debian 11                                     | active |
| daf43e02-f59e-45bb-8d63-436094d3f360 | Ubuntu 21.04                                  | active |

ℹ Note: In case you wonder, the administrator from the target project won't be able to delete the image because he isn't the owner. On the other hand, if the owner of the image deletes it, it will be deleted for all projects.

Here the error you get trying to delete a shared imaged you don't own.

$ openstack image delete 69112d12-0acb-4321-bbc6-f2d493ab6be3
Failed to delete image with name or ID '69112d12-0acb-4321-bbc6-f2d493ab6be3': HttpException: 403: Client Error for url:
3, You are not permitted to delete this image.: 403 Forbidden
Failed to delete 1 of 1 images.