Docker CLI gRPC JavaScript SDK
Перейти к файлу
Djordje Lukic c26f58b510 Remove unused dependecies
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2020-07-08 14:45:43 +02:00
.github/workflows Update protos to latest, adds inspect command 2020-07-01 12:27:29 +02:00
examples Add license 2020-07-06 15:41:19 +02:00
scripts Add exec example 2020-06-12 15:41:56 +02:00
src Export everything by default 2020-07-06 17:19:09 +02:00
test Add publish.sh script to publish on npm 2020-07-07 10:04:09 +02:00
.dockerignore Add publish.sh script to publish on npm 2020-07-07 10:04:09 +02:00
.eslintrc.js Add eslint config 2020-06-09 18:26:54 +02:00
.gitignore Build with typescript 2020-06-10 16:11:15 +02:00
Dockerfile Use docker cli if the docker-linux-amd64 is not present 2020-06-12 16:33:36 +02:00
LICENSE Add license 2020-07-06 15:41:19 +02:00
NOTICE Add license 2020-07-06 15:41:19 +02:00
README.md Remove unused dependecies 2020-07-08 14:45:43 +02:00
babel.config.js Add exec example 2020-06-12 15:41:56 +02:00
package.json Remove unused dependecies 2020-07-08 14:45:43 +02:00
protos.sh Initial commit 2020-06-09 13:08:34 +02:00
publish.sh Add publish.sh script to publish on npm 2020-07-07 10:04:09 +02:00
tsconfig.json Add publish.sh script to publish on npm 2020-07-07 10:04:09 +02:00
yarn.lock Remove unused dependecies 2020-07-08 14:45:43 +02:00

README.md

Docker CLI JavaScript SDK

CI

This repository contains the source for the Node SDK to work with the experimental Docker command line for Azure integration. The SDK is available as an npm package

⚠️ This SDK is in beta, expect things to change or break!

Getting started

Add @docker/sdk to the dependencies

yarn add @docker/sdk

You can then use the SDK:

// import the contexts client
import { Contexts } from '@docker/sdk';
// import request and response classes
import { ListRequest, ListResponse } from '@docker/sdk/contexts';

const client = new Contexts();

// Get the list of contexts
client.list(new ListRequest(), (err: any, resp: ListResponse) => {
  if (err) {
    console.error(err);
    return;
  }

  const contexts = resp.getContextsList().map((c) => c.getName());

  console.log(contexts);
});

When you run this code you should see a list of contexts, for example:

$ ts-node example.ts
aci-context
default

Examples

You can find examples for how to use this SDK in the examples directory.