{"id":16476388,"url":"https://github.com/softprops/tugboat","last_synced_at":"2026-03-10T13:33:28.242Z","repository":{"id":18116350,"uuid":"21190711","full_name":"softprops/tugboat","owner":"softprops","description":"a small boat used for maneuvering docker vessels","archived":false,"fork":false,"pushed_at":"2017-01-10T23:33:50.000Z","size":125,"stargazers_count":60,"open_issues_count":14,"forks_count":20,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-10-18T02:12:30.451Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/softprops.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-25T04:52:10.000Z","updated_at":"2025-04-10T09:34:35.000Z","dependencies_parsed_at":"2022-07-13T06:30:27.322Z","dependency_job_id":null,"html_url":"https://github.com/softprops/tugboat","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/softprops/tugboat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softprops%2Ftugboat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softprops%2Ftugboat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softprops%2Ftugboat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softprops%2Ftugboat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/softprops","download_url":"https://codeload.github.com/softprops/tugboat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softprops%2Ftugboat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30334675,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T12:41:07.687Z","status":"ssl_error","status_checked_at":"2026-03-10T12:41:06.728Z","response_time":106,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T12:42:19.839Z","updated_at":"2026-03-10T13:33:28.202Z","avatar_url":"https://github.com/softprops.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tugboat\n\n\u003e a small boat that maneuvers [Docker](http://www.docker.com/) vessels\n\n[Docker](http://www.docker.com/) is a manager for the containment of applications. Tugboat is a small library\nthat speaks the docker protocol for moving applications and containers in and out of your local seaport.\n\n## install\n\nAdd the following to your sbt project definition\n\n```scala\nresolvers += \"softprops-maven\" at \"http://dl.bintray.com/content/softprops/maven\"\n\nlibraryDependencies += \"me.lessis\" %% \"tugboat\" % \"0.2.0\"\n```\n\n## usage\n\nTugboat provides interfaces for interacting with a docker daemon over http, returning Scala [Futures](http://www.scala-lang.org/api/current/index.html#scala.concurrent.Future) containing docker responses. This requires docker is resolvable via tcp. See the docker [documentation](https://docs.docker.com/engine/reference/commandline/dockerd/#/bind-docker-to-another-hostport-or-a-unix-socket) on how to set this up. In some docker-ready environments like [boot2docker](https://github.com/boot2docker/boot2docker), this is the default.\n\nTugboat will work out of the box communicating with a local docker daemon over a unix domain socket `unix:///var/run/docker.sock` but will adapt when various conventional env vars set.\n\nname               | value\n-------------------|--------------------------------------------------------------------------------------\nDOCKER_HOST        | the tcp host where the docker daemon is bound to\nDOCKER_CERT_PATH   | the base path of were docker tls key.pem, cert.pem, and ca.pem files will be resolved\nDOCKER_TLS_VERIFY  | any non empty string is considered truthy\n\nYou can discover the values for these yourself by typing the following in your terminal\n\n```bash\n$ echo $DOCKER_HOST\n```\n\nSpecific API interfaces like `build`, `events`, `logs`, `push` and `pull`, responses are streamed.\n\nBelow are some examples of manning your local dock.\n\nSince we will be interacting with Scala Future's, an implicit `ExecutionContext` is assumed\n\n```scala\nimport scala.concurrent.ExecutionContext.Implicits.global\n```\n\nCreate a docker tugboat client. You may optionally supply your docker daemon's host as\na constructor argument\n\n```scala\nval docker = tugboat.Docker()\n```\n\nEach operation defined on a docker will define an `apply` interface or a `stream` interface depending no the type of \nresponse the docker daemon serves. Apply interfaces, given no argument, will return a Scala representation of the\nresuling json. You may define your'e own handlers for responses as `Response =\u003e T` where `T` is the type you wish to return.\nThe examples below assume the default Scala representations.\n\n### meta\n\nInspect your station. Identical to the `docker info` command.\n\n```scala\ndocker.info().foreach(println)\n```\n\nPrint the make and model of docker harbor. Identical to the `docker version` command.\n\n```scala\ndocker.version().foreach(println)\n```\n\n### images and containers\n\nSearch the sea of docker images for something that looks like a ship. \nIdentical to the `docker search ship` command.\n\n```scala\ndocker.images.search\n  .term(\"ship\")().foreach {\n    _.foreach { img =\u003e\n      println(img.name)\n    }\n  }\n```\n\nList the images docked at your station\nIdentical to the  `docker images` command.\n\n```scala\ndocker.images.list().foreach {\n  _.foreach { image =\u003e\n    println(image.id)\n  }\n}\n```\n\nBe your own shipping port\n\nKeep an close eye on activity in your harbor\n\n```scala\nimport tugboat.Event\nval (stopper, completeFuture) = docker.events.stream {\n  case Event.Record(status, id, from, time) =\u003e\n     println(s\"container $id: $status\")\n}\n```\n\n// ...fire up, start, stop, and remove some containers\n// to terminate the stream, call stop() on the stopper returned by subscribing\n// to the stream\nstopper.stop()\n\nUsher a ship out to sea\nIdentical to the command `docker build -t ssScala path/to/dir/Dockerfile/is/in`\n\n```scala\nimport tugboat.Build \ndocker.images.build(new java.io.File(\"path/to/dir/Dockerfile/is/in\")).tag(\"ssScala\").stream {\n  case Build.Progress(prog)   =\u003e println(prog)\n  case Build.Status(status)   =\u003e println(status)\n  case Build.Error(err, _, _) =\u003e println(err)\n}\n```\n\nUsher foreign ships into harbor\nIdentical to the `docker pull captain/ship` command\n\n```\nimport tugboat.Pull\ndocker.images.pull(\"captain/ship\").stream {\n  case Pull.Status(msg) =\u003e println(msg)\n  case Pull.Progress(msg, _, details) =\u003e\n    println(msg)\n    details.foreach { dets =\u003e\n      println(dets.bar)\n    }\n  case Pull.Error(msg, _) =\u003e  println(msg)\n}\n```\n\n\nVerify with the admiral that your captain credentials are still respectable\nIdentical to the `docker login -u username -p password -e email` command\n\n```scala\nimport tugboat.AuthConfig\nval auth = AuthConfig(user, password, email)\ndocker.auth(auth)().foreach(println)\n```\n\nAnnounce your captainship when issuing orders to the crew\nIdentical to the `docker pull internalregistry.com/captain/ship` command\n\n```scala\ndocker.as(auth).images.pull(\"captain/ship\").registry(\"internalregistry.com\").stream {\n  case Pull.Status(msg) =\u003e println(msg)\n  case Pull.Progress(msg, _, details) =\u003e\n    println(msg)\n    details.foreach { dets =\u003e\n      println(dets.bar)\n    }\n  case Pull.Error(msg, _) =\u003e  println(msg)\n}\n```\n\nFashion a new boat from a dependable stack of material and start the engines\nIdentical to the `docker run -p 80:80 captain/ship` command\n\n```scala\n(for {\n  container \u003c- docker.containers.create(\"captain/ship\")()\n  run       \u003c- docker.containers.get(container.id).start.bind(\n               tugboat.Port.Tcp(80), tugboat.PortBinding.local(80)\n            )()\n} yield container.id).foreach(println)\n```\n\nProduce a roster of ships out to sea\nIdentical to the `docker ps` command\n\n```scala\ndocker.containers.list().map(_.map(_.id)).foreach(println)\n```\n\n\nAnchor to a live boat\n\n```scala\nval ship = docker.containers.get(id)\n```\n\nInspect the boat.\nIdentical to the `docker inspect ship` command\n\n```scala\nship().foreach(println)\n```\n\nFetch the the captains logs\nIdentical to the `docker logs ship` command\n\n```scala\nship.logs.follow(true).stdout(true).stderr(true).stream(println)\n```\n\nStop the boat after 5 seconds\nIdentical to the `docker stop ship` command\n\n```scala\nimport scala.concurrent.duration._\nship.stop(5.seconds)().foreach(println)\n```\n\nRestart the boat in 5 seconds\nIdentical to the `docker restart ship` command\n\n```scala\nship.restart(5.seconds)().foreach(println)\n```\n\nRetire the ship\nIdentical to the `docker rm ship` command\n\n```scala\nship.destroy.force(true)().foreach(println)\n```\n\nDoug Tangren (softprops) 2014-2015\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftprops%2Ftugboat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftprops%2Ftugboat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftprops%2Ftugboat/lists"}