- Installation
- Usage
- API
- Generating the API Client (openapi-generator)
- Generate documentation
- Building
- Testing
- Contributing
- Issues
- Docker Engine API Reference
To install the package, run:
npm i --save docker-api-ts
const config = {
basePath: "http://localhost:2375"
}
docker = new Docker(config)
const response = await docker.imageCreate(
{
fromImage: "alpine",
tag: "latest"
}
)
const imageId = response.data.Id
const response = await docker.imageDelete(imageId)
const response = await docker.containerCreate({
Image: "alpine",
Cmd: ["echo", "hello world"]
})
const containerId = response.data.Id
const response = await docker.containerStart(containerId)
const response = await docker.containerStop(containerId)
const response = await docker.containerDelete(containerId)
Comprehensive TypeDoc generated documentation is available at:
https://jpholtmeyer.github.io/docker-api-ts
The Docker
class provides the following functions:
- configCreate
- configDelete
- configInspect
- configList
- configUpdate
- containerDelete
- containerArchive
- containerArchiveInfo
- containerAttachWebsocket
- containerChanges
- containerCreate
- containerExport
- containerInspect
- containerKill
- containerList
- containerLogs
- containerPause
- containerPrune
- containerRename
- containerResize
- containerRestart
- containerStart
- containerStats
- containerStop
- containerTop
- containerUnpause
- containerUpdate
- containerWait
- putContainerArchive
- distributionInspect
- containerExec
- execInspect
- execResize
- execStart
- buildPrune
- imageBuild
- imageCommit
- imageCreate
- imageDelete
- imageGet
- imageGetAll
- imageHistory
- imageInspect
- imageList
- imageLoad
- imagePrune
- imagePush
- imageSearch
- imageTag
- networkConnect
- networkCreate
- networkDelete
- networkDisconnect
- networkInspect
- networkList
- networkPrune
- nodeDelete
- nodeInspect
- nodeList
- nodeUpdate
- getPluginPrivileges
- pluginCreate
- pluginDelete
- pluginDisable
- pluginEnable
- pluginInpect
- pluginList
- pluginPull
- pluginPush
- pluginSet
- pluginUpgrade
- secretCreate
- secretDelete
- secretInspect
- secretList
- secretUpdate
- serviceCreate
- serviceDelete
- serviceInspect
- serviceList
- serviceLogs
- serviceUpdate
- session
- swarmInit
- swarmInspect
- swarmJoin
- swarmLeave
- swarmUnlock
- swarmUnlockkey
- swarmUpdate
- systemAuth
- systemDataUsage
- systemEvents
- systemInfo
- systemPing
- systemPingHead
- systemVersion
- taskInspect
- taskList
- taskLogs
- volumeCreate
- volumeDelete
- volumeInspect
- volumeList
- volumePrune
An OpenAPI spec should be placed at the root of the src
directory.
To generate an API client, run npm run generate
.
This will generate a new API client in the src/generated
directory.
NOTE: The only template that has been modified is the index.mustache
template. This acts as consolidating convenience wrapper around the available API clients.
To build the package, run npm run build
.
This will compile the TypeScript code into JavaScript and place the resulting files in the dist
directory.
Tests are built and placed in the dist/__tests__
directory.
A Docker daemon is required to run all tests.
If running tests against a Docker swarm, set the SWARM_MODE
environment variable to true
.
To run the tests, run npm run test
.
This will compile the TypeScript code and then run the tests.
Everyone is welcome to contribute.
Please feel free to fork the repository, make your changes, and submit a pull request.
If you encounter any issues or have suggestions for improvement, please open an issue in the repository.