Giter VIP home page Giter VIP logo

docker-swift-client's Introduction

OpenStack client tooling in Docker

Use a docker image for openstack client tooling!

Rather than futzing with all of the python dependencies to get the openstack cli tools working, use this Docker image as way to get started quickly. There are other openstack-cli images available -- this one uses a smaller footprint by building off of the Alpine image.

Quick Start

docker pull jmcvea/openstack-client

# $(PWD) is mounted to allow for actions requiring host filesystem access.  
# See 'Tips' section below
docker run -ti --rm -v $(PWD):/data jmcvea/openstack-client

# source the rc config file
$ source /data/openrc.sh

Manual Build

Clone this repository, then:

# Build a local docker image
docker build -t openstack-client .

# Start a container from the image and launch into a shell in the container.
# Uses a dotenv file to manage the OpenStack rc env vars.
docker run -it --env-file ~/.osc_rc.env openstack-client

# If you like to mount your config files instead of passing via a dotenv file: (`openrc.sh` must be in the current directory)
docker run -it -v $(PWD):/data openstack-client
$ source /data/openrc.sh

Tips

Accessing a host directory

The /data directory is exposed as a VOLUME that can be mounted. This is convenient for openstack commands that might require reading/writing host filesystems. It is important to remember that commands such as openstack image save should ensure that the location where the image is saved is in the /data folder when using the --rm command line option. Example:

docker run -it --rm -v $(PWD):/data --env-file ${RC_ENV_FILE:-~/.osc_rc.env} jmcvea/openstack-client openstack image save --file /data/test_image.img ${IMAGE_GUID}

Run one-off commands

Run individual commands easily by passing them as the command to run and overriding the default /bin/sh command. For one-off commands, it's a good practice to remove the container with the --rm argument so that you don't collect a bunch of orphaned containers. You will also want to ensure that the rc environment is configured as part of starting the container -- easiest via a .env file containing the openstack rc env vars.

docker run -ti --rm -v $(PWD):/data --env-file ${RC_ENV_FILE:-~/.osc_rc.env} jmcvea/openstack-client cinder list`

Simplify your typing with aliases

# Get into a shell to run openstack commands
alias oscsh='docker run -ti --rm -v $(PWD):/data --env-file ${RC_ENV_FILE:-~/.osc_rc.env} jmcvea/openstack-client'
# Make it look like you're running openstack locally
alias openstack='oscsh openstack'

Contributing

  1. Fork ( http://github.com/jmcvea/docker-openstack-client/fork )
  2. Create a feature branch (git checkout -b new-feature)
  3. Commit changes (git commit -am 'Adding a great new feature')
  4. Push to the branch (git push origin new-feature)
  5. Create a new Pull Request

Copyright

Copyright (c) 2016 Jim McVea

Licensed under MIT

docker-swift-client's People

Contributors

jmcvea avatar adasilva70 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.