Giter VIP home page Giter VIP logo

akka-http-docker's Introduction

Akka HTTP Docker

akka-http-docker is a Docker client that is based on Akka HTTP. It's aim is to provide a Scala and Akka Streams-centric approach to interacting with Docker.

Building

Use SBT:

$ sbt package

Including as a Dependency

To include the akka-http-docker in your project as a dependency, use the Sonatype Snapshot repositories:

resolvers ++= Seq(
  Resolver.sonatypeRepo("snapshots")
),

libraryDependencies ++= {
  Seq(
    // Akka HTTP Docker
    "com.jbrisbin.docker" %% "akka-http-docker" % "0.1.0-SNAPSHOT"
  )
}

Using

The API will be simple in order to express the maximum amount of information with the least amount of static. To list all containers, and map the IDs of those containers to another processing chain, you would do the following:

Docker().containers() onComplete {
  case Success(c) => c.map(_.Id)
  case Failure(ex) => log.error(ex.getMessage, ex)
}

Starting a Container

To start a container, you may need to create one first. You can map the output of the create into another step using flatMap, though, so it can all be done in one step.

To create and start a container, use something like this:

Docker()
  .create(CreateContainer(
    Image="alpine", 
    Volumes = Map("/Users/johndoe/src/myapp" -> "/usr/lib/myapp")
  ))
  .flatMap(c => Docker().start(c.Id))
  .map(c => c ! Exec(Seq("/usr/lib/myapp/bin/start.sh")))

The start() method returns a Future[ActorRef] that represents your link to the container. To interact with a running container, send it messages using ! or ?.

Contributions Welcome!

This is a new project in its infancy. There is a LOT to do if this tool is to be useful to more than just a handful of use cases. If you have the time and inclination, please create a ticket or submit a PR with helpful changes that expand the client functionality and implement some new features that you need.

License

Apache 2.0

akka-http-docker's People

Contributors

jbrisbin 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.