Deleting OpenStack Object Storage containers is quite simple. Any container can be deleted, for as long as they are empty.
Ensure that you are logged on to a correctly configured OpenStack client and can access the OpenStack environment as a user with the swiftoperator
privileges. We will use the developer
user created in the Common OpenStack identity tasks recipe in Chapter 2, The OpenStack Client with the cookbook4
password. We have also granted this user the swiftoperator
privileges.
Refer to Chapter 2, The OpenStack Client, for details of setting up your environment to use OpenStack command-line client.
To delete a Swift container in our environment, execute the following steps:
openstack container list
This will give an output like the following:
openstack container show books
This will show an output like the following:
openstack container delete books
In OpenStack Object Storage, empty containers can be deleted by a user that created them. First, we must make sure that the container is empty by viewing its details:
openstack container show container_name
Then, delete the container with the following command:
openstack container delete container_name
Verify that container is gone by listing available containers:
openstack container list
3.17.154.16