Skip to content

mountain-pass/dockerengineapi-nodejsclient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker_engine_api

DockerEngineApi - JavaScript client for docker_engine_api The Engine API is an HTTP API served by Docker Engine. It is the API the Docker client uses to communicate with the Engine, so everything the Docker client can do can be done with the API. Most of the client's commands map directly to API endpoints (e.g. docker ps is GET /containers/json). The notable exception is running containers, which consists of several API calls. # Errors The API uses standard HTTP status codes to indicate the success or failure of the API call. The body of the response will be JSON in the following format: { \"message\": \"page not found\" } # Versioning The API is usually changed in each release, so API calls are versioned to ensure that clients don't break. To lock to a specific version of the API, you prefix the URL with its version, for example, call /v1.30/info to use the v1.30 version of the /info endpoint. If the API version specified in the URL is not supported by the daemon, a HTTP 400 Bad Request error message is returned. If you omit the version-prefix, the current version of the API (v1.41) is used. For example, calling /info is the same as calling /v1.41/info. Using the API without a version-prefix is deprecated and will be removed in a future release. Engine releases in the near future should support this version of the API, so your client will continue to work even if it is talking to a newer Engine. The API uses an open schema model, which means server may add extra properties to responses. Likewise, the server will ignore any extra query parameters and request body properties. When you write clients, you need to ignore additional properties in responses to ensure they do not break when talking to newer daemons. # Authentication Authentication for registries is handled client side. The client has to send authentication details to various endpoints that need to communicate with registries, such as POST /images/(name)/push. These are sent as X-Registry-Auth header as a base64url encoded (JSON) string with the following structure: { \"username\": \"string\", \"password\": \"string\", \"email\": \"string\", \"serveraddress\": \"string\" } The serveraddress is a domain/IP without a protocol. Throughout this structure, double quotes are required. If you have already got an identity token from the /auth endpoint, you can just pass this instead of credentials: { \"identitytoken\": \"9cbaf023786cd7...\" } This SDK is automatically generated by the Swagger Codegen project:

  • API version: 1.41
  • Package version: 1.41
  • Build package: io.swagger.codegen.languages.JavascriptClientCodegen

Installation

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install docker_engine_api --save
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

Finally, switch to the directory you want to use your docker_engine_api from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

You should now be able to require('docker_engine_api') in javascript files from the directory you ran the last command above from.

git

If the library is hosted at a git repository, e.g. https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:

    npm install GIT_USER_ID/GIT_REPO_ID --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file, that's to say your javascript file where you actually use this library):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var DockerEngineApi = require('docker_engine_api');

var api = new DockerEngineApi.ConfigApi()

var opts = { 
  'body': new DockerEngineApi.object() // {object} 
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.configCreate(opts, callback);

Documentation for API Endpoints

All URIs are relative to http://localhost/v1.41

Class Method HTTP request Description
DockerEngineApi.ConfigApi configCreate POST /configs/create Create a config
DockerEngineApi.ConfigApi configDelete DELETE /configs/{id} Delete a config
DockerEngineApi.ConfigApi configInspect GET /configs/{id} Inspect a config
DockerEngineApi.ConfigApi configList GET /configs List configs
DockerEngineApi.ConfigApi configUpdate POST /configs/{id}/update Update a Config
DockerEngineApi.ContainerApi containerArchive GET /containers/{id}/archive Get an archive of a filesystem resource in a container
DockerEngineApi.ContainerApi containerArchiveInfo HEAD /containers/{id}/archive Get information about files in a container
DockerEngineApi.ContainerApi containerAttach POST /containers/{id}/attach Attach to a container
DockerEngineApi.ContainerApi containerAttachWebsocket GET /containers/{id}/attach/ws Attach to a container via a websocket
DockerEngineApi.ContainerApi containerChanges GET /containers/{id}/changes Get changes on a container’s filesystem
DockerEngineApi.ContainerApi containerCreate POST /containers/create Create a container
DockerEngineApi.ContainerApi containerDelete DELETE /containers/{id} Remove a container
DockerEngineApi.ContainerApi containerExport GET /containers/{id}/export Export a container
DockerEngineApi.ContainerApi containerInspect GET /containers/{id}/json Inspect a container
DockerEngineApi.ContainerApi containerKill POST /containers/{id}/kill Kill a container
DockerEngineApi.ContainerApi containerList GET /containers/json List containers
DockerEngineApi.ContainerApi containerLogs GET /containers/{id}/logs Get container logs
DockerEngineApi.ContainerApi containerPause POST /containers/{id}/pause Pause a container
DockerEngineApi.ContainerApi containerPrune POST /containers/prune Delete stopped containers
DockerEngineApi.ContainerApi containerRename POST /containers/{id}/rename Rename a container
DockerEngineApi.ContainerApi containerResize POST /containers/{id}/resize Resize a container TTY
DockerEngineApi.ContainerApi containerRestart POST /containers/{id}/restart Restart a container
DockerEngineApi.ContainerApi containerStart POST /containers/{id}/start Start a container
DockerEngineApi.ContainerApi containerStats GET /containers/{id}/stats Get container stats based on resource usage
DockerEngineApi.ContainerApi containerStop POST /containers/{id}/stop Stop a container
DockerEngineApi.ContainerApi containerTop GET /containers/{id}/top List processes running inside a container
DockerEngineApi.ContainerApi containerUnpause POST /containers/{id}/unpause Unpause a container
DockerEngineApi.ContainerApi containerUpdate POST /containers/{id}/update Update a container
DockerEngineApi.ContainerApi containerWait POST /containers/{id}/wait Wait for a container
DockerEngineApi.ContainerApi putContainerArchive PUT /containers/{id}/archive Extract an archive of files or folders to a directory in a container
DockerEngineApi.DistributionApi distributionInspect GET /distribution/{name}/json Get image information from the registry
DockerEngineApi.ExecApi containerExec POST /containers/{id}/exec Create an exec instance
DockerEngineApi.ExecApi execInspect GET /exec/{id}/json Inspect an exec instance
DockerEngineApi.ExecApi execResize POST /exec/{id}/resize Resize an exec instance
DockerEngineApi.ExecApi execStart POST /exec/{id}/start Start an exec instance
DockerEngineApi.ImageApi buildPrune POST /build/prune Delete builder cache
DockerEngineApi.ImageApi imageBuild POST /build Build an image
DockerEngineApi.ImageApi imageCommit POST /commit Create a new image from a container
DockerEngineApi.ImageApi imageCreate POST /images/create Create an image
DockerEngineApi.ImageApi imageDelete DELETE /images/{name} Remove an image
DockerEngineApi.ImageApi imageGet GET /images/{name}/get Export an image
DockerEngineApi.ImageApi imageGetAll GET /images/get Export several images
DockerEngineApi.ImageApi imageHistory GET /images/{name}/history Get the history of an image
DockerEngineApi.ImageApi imageInspect GET /images/{name}/json Inspect an image
DockerEngineApi.ImageApi imageList GET /images/json List Images
DockerEngineApi.ImageApi imageLoad POST /images/load Import images
DockerEngineApi.ImageApi imagePrune POST /images/prune Delete unused images
DockerEngineApi.ImageApi imagePush POST /images/{name}/push Push an image
DockerEngineApi.ImageApi imageSearch GET /images/search Search images
DockerEngineApi.ImageApi imageTag POST /images/{name}/tag Tag an image
DockerEngineApi.NetworkApi networkConnect POST /networks/{id}/connect Connect a container to a network
DockerEngineApi.NetworkApi networkCreate POST /networks/create Create a network
DockerEngineApi.NetworkApi networkDelete DELETE /networks/{id} Remove a network
DockerEngineApi.NetworkApi networkDisconnect POST /networks/{id}/disconnect Disconnect a container from a network
DockerEngineApi.NetworkApi networkInspect GET /networks/{id} Inspect a network
DockerEngineApi.NetworkApi networkList GET /networks List networks
DockerEngineApi.NetworkApi networkPrune POST /networks/prune Delete unused networks
DockerEngineApi.NodeApi nodeDelete DELETE /nodes/{id} Delete a node
DockerEngineApi.NodeApi nodeInspect GET /nodes/{id} Inspect a node
DockerEngineApi.NodeApi nodeList GET /nodes List nodes
DockerEngineApi.NodeApi nodeUpdate POST /nodes/{id}/update Update a node
DockerEngineApi.PluginApi getPluginPrivileges GET /plugins/privileges Get plugin privileges
DockerEngineApi.PluginApi pluginCreate POST /plugins/create Create a plugin
DockerEngineApi.PluginApi pluginDelete DELETE /plugins/{name} Remove a plugin
DockerEngineApi.PluginApi pluginDisable POST /plugins/{name}/disable Disable a plugin
DockerEngineApi.PluginApi pluginEnable POST /plugins/{name}/enable Enable a plugin
DockerEngineApi.PluginApi pluginInspect GET /plugins/{name}/json Inspect a plugin
DockerEngineApi.PluginApi pluginList GET /plugins List plugins
DockerEngineApi.PluginApi pluginPull POST /plugins/pull Install a plugin
DockerEngineApi.PluginApi pluginPush POST /plugins/{name}/push Push a plugin
DockerEngineApi.PluginApi pluginSet POST /plugins/{name}/set Configure a plugin
DockerEngineApi.PluginApi pluginUpgrade POST /plugins/{name}/upgrade Upgrade a plugin
DockerEngineApi.SecretApi secretCreate POST /secrets/create Create a secret
DockerEngineApi.SecretApi secretDelete DELETE /secrets/{id} Delete a secret
DockerEngineApi.SecretApi secretInspect GET /secrets/{id} Inspect a secret
DockerEngineApi.SecretApi secretList GET /secrets List secrets
DockerEngineApi.SecretApi secretUpdate POST /secrets/{id}/update Update a Secret
DockerEngineApi.ServiceApi serviceCreate POST /services/create Create a service
DockerEngineApi.ServiceApi serviceDelete DELETE /services/{id} Delete a service
DockerEngineApi.ServiceApi serviceInspect GET /services/{id} Inspect a service
DockerEngineApi.ServiceApi serviceList GET /services List services
DockerEngineApi.ServiceApi serviceLogs GET /services/{id}/logs Get service logs
DockerEngineApi.ServiceApi serviceUpdate POST /services/{id}/update Update a service
DockerEngineApi.SessionApi session POST /session Initialize interactive session
DockerEngineApi.SwarmApi swarmInit POST /swarm/init Initialize a new swarm
DockerEngineApi.SwarmApi swarmInspect GET /swarm Inspect swarm
DockerEngineApi.SwarmApi swarmJoin POST /swarm/join Join an existing swarm
DockerEngineApi.SwarmApi swarmLeave POST /swarm/leave Leave a swarm
DockerEngineApi.SwarmApi swarmUnlock POST /swarm/unlock Unlock a locked manager
DockerEngineApi.SwarmApi swarmUnlockkey GET /swarm/unlockkey Get the unlock key
DockerEngineApi.SwarmApi swarmUpdate POST /swarm/update Update a swarm
DockerEngineApi.SystemApi systemAuth POST /auth Check auth configuration
DockerEngineApi.SystemApi systemDataUsage GET /system/df Get data usage information
DockerEngineApi.SystemApi systemEvents GET /events Monitor events
DockerEngineApi.SystemApi systemInfo GET /info Get system information
DockerEngineApi.SystemApi systemPing GET /_ping Ping
DockerEngineApi.SystemApi systemPingHead HEAD /_ping Ping
DockerEngineApi.SystemApi systemVersion GET /version Get version
DockerEngineApi.TaskApi taskInspect GET /tasks/{id} Inspect a task
DockerEngineApi.TaskApi taskList GET /tasks List tasks
DockerEngineApi.TaskApi taskLogs GET /tasks/{id}/logs Get task logs
DockerEngineApi.VolumeApi volumeCreate POST /volumes/create Create a volume
DockerEngineApi.VolumeApi volumeDelete DELETE /volumes/{name} Remove a volume
DockerEngineApi.VolumeApi volumeInspect GET /volumes/{name} Inspect a volume
DockerEngineApi.VolumeApi volumeList GET /volumes List volumes
DockerEngineApi.VolumeApi volumePrune POST /volumes/prune Delete unused volumes

Documentation for Models

Documentation for Authorization

All endpoints do not require authorization.

About

A NodeJS client generated from the Docker Engine OpenApi spec.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published