Setting up openstack swift single instance in docker


Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications, whether on laptops, data center VMs, or the cloud.In today’s tutorial we are going to see how to install docker and set up openstack instance in ubuntu.

The steps are as follows:

Docker can be installed using older package or new docker-engine package.In order to install from package run the following commands:

To install from docker-engine run the following commands:

To check whether docker is installed correctly run the following command:

Since docker requires superuser privileges to run correctly it might be a good idea to drop into root user using sudo su command.

In order to allow docker service to start on system boot run the following command:

Now lets move forward with setting up openstack swift in docker:

First we create persistence storage for our swift container:

We are going to use swift dockerfile for single instance which can be found here: Github

In order to create and run the docker container run the following command:

In the above command we have set restart flag to always restart the container regardless of the exit status, used storage volume SWIFT_DATA we created earlier and docker file mentioned earlier and redirecting port 8080 on docker instance to 12345 on host machine.

In order to connect to our swift docker instance we need to install python swiftclient:

The syntax for running the swift client commands is:

Run the following command to test connection your instance:


Here auth url points to port 12345 of host machine’s localhost which will be redirected to port 8080 of docker container,username is tester from usergroup test and password is testing.The stat command┬áreturns basic information about the user’s account.

Alternatively if you would like to run commands directly instead of specifying authurl,username and password each time you can set them as environment variables in your bashrc file as follows:

Run the following command to open bashrc file:

Paste the following code at the end of the file and save the file:

Next run the following command to allow swift client to load the parameters from shell environment:

Now you can run all the commands directly like:

The list of available commands in swift client are:

  • Stat command to display container information:
  • Upload command to upload files:

    For example to create simultaneously create container named CloudPics and upload picture.png to it run the following command:
  • Download command to download files from container:


List all the contents of a container:

For example to list all the contents of CloudPics container:



That concludes today’s tutorial.This tutorial was inspired from original blog post on running openstack swift in docker on virtualbox,vagrant or vmware which can be found here.

Bonus Tip:

If you like to run openstack swift only for cloud stoage in production environment then swiftstack might be a viable option to try.

Connect Deeper:

In the next tutorial I am going to cover how to store files uploaded by users into swift using reactjs for frontend web interface and nodejs in the backend so follow our facebook page to get notified about upcoming tutorials here: Technoetics

Share post-
About Saurabh Mhatre 71 Articles
Currently working in web and hybrid application development