Getting started with ualbertalib/swift_dev docker image
https://travis-ci.org/ualbertalib/di_docker_images.svg?branch=master
This image that implements Swift - highly available, distributed, consistent object store. This image was created for development purposes to quickly instantiate running instance of swift object store.
You need to download ualbertalib/swift_dev docker image from docker hub
docker pull ualbertalib/swift_dev
Alternatively you can build swift image locally
- Clone current project:
git clone https://github.com/ualbertalib/di_docker_swift.git
- Go to the directory where you cloned the project
docker build . -t ualbertalib/swift_dev
University of Alberta maintains a Docker Hub repository at https://hub.docker.com/r/ualibraries. Docker image is registered with Docker Hub: ualbertalib/swift_dev
Create directory where all swift node files will be stored.
mkdir ~/.swift
Set environment variable to point to that directory
export LOCAL_SWIFT_STORAGE=~/.swift
Run provided shell script
./runDockerSwift.sh
Point your browser http://127.0.0.1:8080/info
You should get information in json format about your docker running instance of swift
To shut t down, discover the container name (the last element) with:
docker ps
Then run
docker stop <container_name>
Install swift python client:
cd ~
git clone git clone https://github.com/openstack/python-swiftclient.git
cd python-swiftclient
sudo python setup.py develop; cd -
Source provided rc file (in DIDockerImages/Swift)
. ./swiftrc
Now you can create container
swd post newCont
Upload file to the container
swd upload newCont myfile
List containers
swd list
List files in a container
swd list newCont
Display information about object
swd stat newCont myfile
This always works:
$swd --help
to get more info
You can also use curl to access swift
curl -v -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://127.0.0.1:8080/auth/v1.0
will return authorization token you can use with all your future curl command to access swift
Summary of curl commands: Create a new container
curl -X PUT -H 'X-Auth-Token: <token-from-above>' http://127.0.0.1:8080/v1/AUTH_test/container2
$ist all containers in an account
curl -X GET -H 'X-Auth-Token: <token-from-above>' http://127.0.0.1:8080/v1/AUTH_test
List all the objects in a container
curl -X GET -H 'X-Auth-Token: <token-from-above>' http://127.0.0.1:8080/v1/AUTH_test/container2
Lownload an object
curl -X GET -H 'X-Auth-Token: <token-from-above>' http://127.0.0.1:8080/v1/AUTH_test/container2/someFile.txt
Instructions here