1.1 KiB
1.1 KiB
dockersock
easy communication with docker remote api from node, TypeScript ready
Status
Usage
We recommend the use of TypeScript for best Intellisense.
import {Dockersock} from "dockersock"; // require Dockersock class
let myDockersock = new Dockersock(); // optional: you can pass a domain to the contructor, defaults to /var/run/docker.sock
myDockersock.listContainers() // promise, resolve gets container data
myDockersock.listContainersDetailed() // promise, resolve gets more detailed container data (by combining several requests internally)
myDockersock.listContainersRunning() // promise, resolve gets container data for currently running containers
myDockersock.listContainersStopped() // promise, resolve gets container data for stopped containers
myDockersock.startContainer({ // starts a already present container
name: "somecontainername"
})
myDockersock.newContainer({ // start new Container, equals "docker run" shell command
image: "someimagetag"
})