Skip to content

zuazo-forks/docker-compose-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Code Climate Test Coverage Gem Version

Docker Compose Api

Docker Compose API provides an easy way to parse docker compose files and lift the whole environment.

Instalation

Install the gem in whole environment

gem install docker-compose-api

... or using Bundler

# Add the line below on your Gemfile...
gem 'docker-compose-api', git: 'https://github.com/mauricioklein/docker-compose-api'

# ... and run bundle install
bundle install

Usage

require 'docker-compose'

# Docker compose is simply a layer running over Docker client (https://github.com/swipely/docker-api).
# So, all Docker specific configurations, such URL, authentication, SSL, etc, must be made directly on
# Docker client.
#
# Docker compose provides an easy way to access this client:
DockerCompose.docker_client

# Gem version
DockerCompose.version

# Loading a compose file
compose = DockerCompose.load('[path to docker compose file]')

# Accessing containers
compose.containers                     # access all containers
compose.containers['[container name]'] # access a specific container

# Starting containers (and their dependencies)
compose.start                                    # start all containers
compose.start(['container1', 'container2', ...]) # start a list of specific containers

# Stopping containers
# (ps: container dependencies will keep running)
compose.stop                                    # stop all containers
compose.stop(['container1', 'container2', ...]) # stop a list of specific containers

# Killing containers
# (ps: container dependencies will keep running)
compose.kill                                    # kill all containers
compose.kill(['container1', 'container2', ...]) # kill a list of specific containers

# Deleting containers
# (ps: container dependencies will keep running)
compose.delete                                    # delete all containers
compose.delete(['container1', 'container2', ...]) # delete a list of specific containers

# Checking if a container is running or not
a_container = compose.containers['a_container']
a_container.running?

# Accessing container informations
a_container.stats

Contributing

  1. Fork it ( https://github.com/mauricioklein/docker-compose-api/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

About

A Docker compose parser for Ruby

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%