Docker to run the openstack client

Today the openstack client on my Mac did not survive the upgrade of some python libraries. After upgrading with pip to the latest version, I was not able anymore to list networks:

'ascii' codec can't encode characters in position 5889-5894: ordinal not in range(128)

After 5 minutes I was already sick of trying to fix the problem on my Mac, and I started working on this Dockerfile that was initially developed by Christian at SWITCH
If you want to try the result of my work, do the following.
Create a folder and put there your openstack config

mkdir ~/rc
vim ~/rc/default-openrc.sh

Pull my docker image (or experts can build their own using the Dockerfile):

docker pull zioproto/oscli

Now add to your bash_profile the following alias:

alias oscli='docker run -ti -v ~/rc:/home/docker/rc -v ~/myscripts:/home/docker/myscripts zioproto/oscli'

Note that I also added to the containers a myscript folder where I keep scripts that I usually run to operate Openstack. This is optional. You can skip that -v if you dont have any additional script that you want to use.
Great, now just type oscli and enjoy an openstack client that survives any change in the python libraries of your host system 🙂

Saverio

This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *