Run the OpenStack clients in a Docker container.
OpenStack Client is a command-line client for OpenStack that brings the command set for Compute, Identity, Image, Object Store and Block Storage APIs together in a single shell with a uniform command structure.
This is a client library for Heat built on the Heat orchestration API. It provides a Python API (the heatclient module) and a command-line tool (heat).
Modify and build the container image from source:
git clone https://github.com/42BV/docker-openstack-client.git
cd docker-openstack-client
docker build -t openstack-client:<tag> .
- latest (Dockerfile)
Download a ready for use container image:
docker pull 42bv/openstack-client:latest
Create a clouds.yaml file. You can find this information the the Horizon dashboard. You can add mutiple clouds to this file.
clouds:
<cloud>:
auth:
auth_url: "<url>"
username: "<username>"
password: "<password>"
user_domain_name: "Default"
project_domain_name: "Default"
project_name: "<project>" # optional
region_name: "<region>"
identity_api_version: 3
- Make sure you set (
-e
) theOS_CLOUD
variable with the name of your cloud. - Mount (
-v
) the directory containingclouds.yaml
to/etc/openstack
.
docker run -it --rm -v $PWD:/etc/openstack -e "OS_CLOUD=<cloud>" --name openstack-client 42bv/openstack-client:latest
docker run -id --rm -v $PWD:/etc/openstack -e "OS_CLOUD=<cloud>" --name openstack-client 42bv/openstack-client:latest
docker exec openstack-client openstack <subcommand>
To see if you are connected to your cloud run:
configuration show
Template Guide: https://docs.openstack.org/heat/latest/template_guide/index.html
Using templates to launch a stack:
- Run openstack-client in "Detached Mode" as described above.
- When referencing Heat Orchestration Templates, note that the workdir inside the container is
/etc/openstack
.
docker exec openstack-client openstack stack create -t /etc/openstack/<template.yaml> <stack_name>