{"id":20485317,"url":"https://github.com/runnable/loki","last_synced_at":"2025-04-13T14:53:06.902Z","repository":{"id":70964852,"uuid":"57406015","full_name":"Runnable/loki","owner":"Runnable","description":"Loki: Runnable Docker/Swarm library with batteries","archived":false,"fork":false,"pushed_at":"2017-05-31T21:47:30.000Z","size":48,"stargazers_count":6,"open_issues_count":44,"forks_count":0,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-27T05:51:11.567Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/Runnable.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-29T18:48:34.000Z","updated_at":"2023-08-19T18:43:54.000Z","dependencies_parsed_at":"2023-03-22T05:17:48.710Z","dependency_job_id":null,"html_url":"https://github.com/Runnable/loki","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Runnable%2Floki","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Runnable%2Floki/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Runnable%2Floki/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Runnable%2Floki/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Runnable","download_url":"https://codeload.github.com/Runnable/loki/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248732509,"owners_count":21152851,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-11-15T16:29:26.509Z","updated_at":"2025-04-13T14:53:06.896Z","avatar_url":"https://github.com/Runnable.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# loki\n\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)\n[![Build Status](https://travis-ci.org/Runnable/loki.svg?branch=master)](https://travis-ci.org/Runnable/loki)\n[![Code Climate](https://codeclimate.com/github/Runnable/loki/badges/gpa.svg)](https://codeclimate.com/github/Runnable/loki)\n[![Dependency Status](https://david-dm.org/Runnable/loki.svg)](https://david-dm.org/Runnable/loki)\n[![devDependency Status](https://david-dm.org/Runnable/loki/dev-status.svg)](https://david-dm.org/Runnable/loki)\n\n[![NPM](https://nodei.co/npm/@runnable/loki.svg?compact=true)](https://nodei.co/npm/@runnable/loki)\n\n\nRunnable Docker/Swarm client library with batteries.\n\n\n![Loki](https://upload.wikimedia.org/wikipedia/commons/thumb/4/40/Processed_SAM_loki.jpg/360px-Processed_SAM_loki.jpg)\n\n\n## Features\n\n   * include both Docker and Swarm clients\n   * Swarm client has all additional [swarmerode](https://github.com/Runnable/swarmerode) Promisified methods\n   * automatically report each docker call to datadog using [dogerode](https://github.com/Runnable/dogerode)\n   * HTTPS certs are required. Will throw an error\n   * Base client includes Promisified container actions like `stopContainer`, `logContainer` etc\n   * You can still call Dockerode directly. Dockerode instance is available under `client` property\n\n\n## Usage\n\nYou can use loki Docker client Promisified extra container functions like this:\n\n```javascript\n  const Docker = require('loki').Docker\n\n  const dockerClient = new Docker({ host: 'https://127.0.0.1:4242'})\n  dockerClient.stopContainerAsync('71501a8ab0f8')\n    .then(function () {\n      console.log('container stopped')\n    })\n    .catch(function (err) {\n      console.log('container failed to stop', err)\n    })\n\n```\n\nYou can use loki Dockerode client methods like this:\n\n```javascript\n  const Docker = require('loki').Docker\n\n  const dockerClient = new Docker({ host: 'https://127.0.0.1:4242'})\n  dockerClient.getContainer('71501a8ab0f8')\n    .stop(function (err) {\n      if (err) {\n        return console.log('container failed to stop', err)\n      }\n      console.log('container stopped')\n    })\n```\n\nYou can use loki Dockerode promisified methods directly like this:\n\n```javascript\n  const Docker = require('loki').Docker\n\n  const dockerClient = new Docker({ host: 'https://127.0.0.1:4242'})\n  dockerClient.listConatinersAsync('71501a8ab0f8')\n    .then(function (containers) {\n      console.log('found containers')\n    })\n```\n\nYou can extend loki Docker client with your app specific functions:\n\n```javascript\n  const Docker = require('loki').Docker\n\n  class MyDocker extends Docker {\n\n\n  }\n\n  const myDocker = new MyDocker()\n  dockerClient.stopContainerAsync('71501a8ab0f8')\n    .then(function () {\n      console.log('container stopped')\n    })\n    .catch(function (err) {\n      console.log('container failed to stop', err)\n    })\n```\n\n\n## Base functions\n\nEvery Loki client include utility Promise-based functions\nto deal with containers.\n\nE.x. instead of this code\n\n```javascript\n  const Docker = require('loki').Docker\n\n  const dockerClient = new Docker({ host: 'https://127.0.0.1:4242'})\n  dockerClient.getContainer('71501a8ab0f8')\n    .stop(function (err) {\n      console.log('stopped container?', err)\n    })\n\n```\n\nYou can do the following\n\n```javascript\n  const Docker = require('loki').Docker\n\n  const dockerClient = new Docker({ host: 'https://127.0.0.1:4242'})\n  dockerClient.stopContainerAsync('71501a8ab0f8')\n    .then(function () {\n      console.log('container was stopped')\n    })\n\n```\n\n  - topContainerAsync\n  - startContainerAsync\n  - commitContainerAsync\n  - inspectContainerAsync\n  - stopContainerAsync\n  - pauseContainerAsync\n  - unpauseContainerAsync\n  - restartContainerAsync\n  - resizeContainerAsync\n  - attachContainerAsync\n  - removeContainerAsync\n  - killContainerAsync\n  - execContainerAsync\n  - renameContainerAsync\n  - logsContainerAsync\n  - statsContainerAsync\n  - getArchiveContainerAsync\n  - infoArchiveContainerAsync\n  - putArchiveContainerAsync\n  - updateContainerAsync\n\n\n## Swarm functions\n\n  - swarmHostsAsync\n  - swarmInfoAsync\n  - swarmHostExistsAsync\n\n\n## Conventions\n\n * Each client instance has all functions from Dockerode client available to call directly.\n * Each client instance has Promisified Dockerode functions available with `Async` suffix.\n * Each Swarm client instance has all functions from Swarmerode client available to call directly.\n * Each Swarm client instance has Promisified Swarmerode functions available with `Async` suffix.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunnable%2Floki","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frunnable%2Floki","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunnable%2Floki/lists"}