apocas / dockerode
Docker + Node = Dockerode (Node.js module for Docker's Remote API)
AI Architecture Analysis
This repository is indexed by RepoMind. By analyzing apocas/dockerode in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.
Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.
Repository Overview (README excerpt)
Crawler viewdockerode Not another Node.js Docker Remote API module. objectives: • **streams** - does NOT break any stream, it passes them to you allowing for some stream voodoo. • **stream demux** - Supports optional stream demultiplexing. • **entities** - containers, images and execs are defined entities and not random static methods. • **run** - allow you to seamless run commands in a container aka . • **tests** - really aims to have a good test set, allowing to follow changes easily, quickly and painlessly. • **feature-rich** - There's a real effort in keeping **All** Remote API features implemented and tested. • **interfaces** - Features **callback** and **promise** based interfaces, making everyone happy :) Ecosystem • docker-modem https://github.com/apocas/docker-modem - Docker's API network stack • dockerode-compose https://github.com/apocas/dockerode-compose - docker-compose in Node.js Installation Usage • Input options are directly passed to Docker. Check Docker API documentation for more details. • Return values are unchanged from Docker, official Docker documentation will also apply to them. • Check the tests and examples folder for more examples. Getting started To use first you need to instantiate it: Manipulating a container: You may also specify default options for each container's operations, which will always be used for the specified container and operation. Stopping all containers on a host Building an Image Context: provides the path to the Dockerfile. Additionaly files that are involved in the build *must* be explicitly mentioned in src array, since they are sent to a temp env to build. Example: file for COPY command are extracted from that temporary environment. returns a Promise of NodeJS stream. In case you want to find out when the build has finished, you must follow the progress of the build with the instance in dockerode: Creating a container: Streams goodness: There is also support for HTTP connection hijacking, which allows for cleaner interactions with commands that work with stdin and stdout separately. Equivalent of in : • - container image • - command to be executed • - stream(s) which will be used for execution output. • - (optional) Options used for container creation. Refer to the DockerEngine ContainerCreate documentation for the possible values • - (optional) Options used for container start. Refer to the DockerEngine ContainerStart documentation for the possible values • - callback called when execution ends (optional, promise will be returned if not used). or, if you want to split stdout and stderr (you must to pass as an option for this to work) If you provide a callback, will return an EventEmitter supporting the following events: container, stream, data. If a callback isn't provided a promise will be returned. And here is one more complex example using auto-remove and Docker network. Equivalent of in : • - container image name (optionally with tag) • - extra options passed to create image. • - callback called when execution ends. Pull from private repos already base64 encodes the necessary auth object for you. If you already have a base64 encoded auth object, you can use it directly: Helper functions • - allows to fire a callback only in the end of a stream based process. (build, pull, ...) • - demux stdout and stderr Sponsors Amazing entities that sponsor my open-source work. Check them out! Documentation Docker • docker.createContainer(options) - Docker API Endpoint • docker.createImage([auth], options) - Docker API Endpoint • docker.loadImage(file, options) - Docker API Endpoint • docker.importImage(file, options) - Docker API Endpoint • docker.buildImage(file, options) - Docker API Endpoint • docker.checkAuth(options) - Docker API Endpoint • docker.getContainer(id) - Returns a Container object. • docker.getImage(name) - Returns an Image object. • docker.getVolume(name) - Returns a Volume object. • docker.getPlugin(name) - Returns a Plugin object. • docker.getService(id) - Returns a Service object. • docker.getTask(id) - Returns a Task object. • docker.getNode(id) - Returns a Node object. • docker.getNetwork(id) - Returns a Network object. • docker.getSecret(id) - Returns a Secret object. • docker.getConfig(id) - Returns a Config object. • docker.getExec(id) - Returns a Exec object. • docker.listContainers(options) - Docker API Endpoint • docker.listImages(options) - Docker API Endpoint • docker.listServices(options) - Docker API Endpoint • docker.listNodes(options) - Docker API Endpoint • docker.listTasks(options) - Docker API Endpoint • docker.listSecrets(options) - Docker API Endpoint • docker.listConfigs(options) - Docker API Endpoint • docker.listPlugins(options) - Docker API Endpoint • docker.listVolumes(options) - Docker API Endpoint • docker.listNetworks(options) - Docker API Endpoint • docker.createSecret(options) - Docker API Endpoint • docker.createConfig(options) - Docker API Endpoint • docker.createPlugin(options) - Docker API Endpoint • docker.createVolume(options) - Docker API Endpoint • docker.createService(options) - Docker API Endpoint • docker.createNetwork(options) - Docker API Endpoint • docker.pruneImages(options) - Docker API Endpoint • docker.pruneBuilder() - Docker API Endpoint • docker.pruneContainers(options) - Docker API Endpoint • docker.pruneVolumes(options) - Docker API Endpoint • docker.pruneNetworks(options) - Docker API Endpoint • docker.searchImages(options) - Docker API Endpoint • docker.info() - Docker API Endpoint • docker.version() - Docker API Endpoint • docker.ping() - Docker API Endpoint • docker.df() - Docker API Endpoint • docker.getEvents(options) - Docker API Endpoint • docker.swarmInit(options) - Docker API Endpoint • docker.swarmJoin(options) - Docker API Endpoint • docker.swarmLeave(options) - Docker API Endpoint • docker.swarmUpdate(options) - Docker API Endpoint • docker.swarmInspect() - Docker API Endpoint • docker.pull(repoTag, options, callback, auth) - Like Docker's CLI…