@repoxcode/docker v0.1.0
DockerSDK
Node.js Docker SDK BETA
📣 BETA Version\ This package is still in BETA, there may still be bugs. Please report any bugs to GitHub
Getting started
Docker SDK adalah alat untuk terhubung dengan Docker engine melalui Node.js. You can use this package on linux or windows operating system.
Package Installation
Installation using NPM
npm i @repoxcode/dockerInstallation using Yarn
npm add @repoxcode/dockerCreate Object
const dockersdk = new Dockersdk();
// example: get container list
const container = dockersdk.getContainerList();Setting Socket
Dockersdk has automatically determined the location of your docker socket according to your operating system, but if you have a docker socket location that does not match the default settings, you can determine it using an environment variable, as in the example below.
DOCKERSDK_SOCKET_PATH="socket/location/docker.sock"Reference
For the time being, you can use the reference to the docker api to define parameters in the SDK, you can adjust the parameters used with the parameters in the SDK.
Container
Returns a list of containers. For details on the format, see the inspect endpoint.
Note that it uses a different, smaller representation of a container than inspecting a single container. For example, the list of linked containers is not propagated.
- Get Container List
- Create Container
- Inspect a container
- List processes running inside a container
- Get container logs
- Get changes on a container’s filesystem
- Export a container
- Get container stats based on resource usage
- Resize a container TTY
- Start Container
- Stop Container
- Restart Container
- Kill a container
- Update a container
- Rename a container
- Pause a container
- Unpause a container
- Attach to a container
- Attach to a container via a websocket
- Wait for a container
- Remove a container
- Get information about files in a container
- Get an archive of a filesystem resource in a container
- Extract an archive of files or folders to a directory in a container
- Delete stopped containers
Image
Returns a list of images on the server. Note that it uses a different, smaller representation of an image than inspecting a single image.
- Get Image List
- Build an image
- Delete builder cache
- Create an image
- Inspect an image
- Get the history of an image
- Push an image
- Tag an image
- Remove an image
- Search images
- Delete unused images
- Create a new image from a container
- Export an image
- Export several images
- Import images
Network
Networks are user-defined networks that containers can be attached to. See the networking documentation for more information.
- List networks
- Inspect a network
- Remove a network
- Create a network
- Connect a container to a network
- Disconnect a container from a network
- Delete unused networks
Volume
Create and manage persistent storage that can be attached to containers.
- List volumes
- Create a volume
- Inspect a volume
- Update a volume. Valid only for Swarm cluster volumes
- Remove a volume
- Delete unused volumes
Exec
Run new commands inside running containers. Refer to the command-line reference for more information.
To exec a command in a container, you first need to create an exec instance, then start it. These two API endpoints are wrapped up in a single command-line command, docker exec.
Swarm
Engines can be clustered together in a swarm. Refer to the swarm mode documentation for more information.
- Inspect Swarm
- Initialize Swarm
- Join Existing Swarm
- Leave Swarm
- Update Swarm
- Get Unlock Key
- Unlock a Locked Manager
Nodes
Nodes are instances of the Engine participating in a swarm. Swarm mode must be enabled for these endpoints to work.
Services
Services are the definitions of tasks to run on a swarm. Swarm mode must be enabled for these endpoints to work.
Tasks
A task is a container running on a swarm. It is the atomic scheduling unit of swarm. Swarm mode must be enabled for these endpoints to work.
Secrets
Secrets are sensitive data that can be used by services. Swarm mode must be enabled for these endpoints to work.
Configs
Configs are application configurations that can be used by services. Swarm mode must be enabled for these endpoints to work.
Plugins
- List plugins
- Get plugin privileges
- Install a plugin
- Inspect a plugin
- Remove a plugin
- Enable a plugin
- Disable a plugin
- Upgrade a plugin
- Create a plugin
- Push a plugin
- Configure a plugin
System
- Check auth configuration
- Get system information
- Get version
- Ping
- Ping
- Monitor events
- Get data usage information
Distribution
Session
10 months ago