@robinpath/docker
0.1.1Node.jsPublicDocker container and image management using the system docker binary
Docker
Docker container and image management using the system docker binary
Package: @robinpath/docker | Category: Devops | Type: Integration
Authentication
No authentication required. All functions are available immediately.
Use Cases
Use the docker module when you need to:
- List Docker containers -- Use
docker.psto perform this operation - List Docker images -- Use
docker.imagesto perform this operation - Run a new container from an image -- Use
docker.runto perform this operation - Stop a running container -- Use
docker.stopto perform this operation - Start a stopped container -- Use
docker.startto perform this operation
Quick Reference
| Function | Description | Returns |
|---|---|---|
ps | List Docker containers | object |
images | List Docker images | object |
run | Run a new container from an image | object |
stop | Stop a running container | object |
start | Start a stopped container | object |
rm | Remove a container | object |
rmi | Remove a Docker image | object |
logs | Fetch logs from a container | object |
exec | Execute a command inside a running container | object |
build | Build a Docker image from a Dockerfile | object |
pull | Pull a Docker image from a registry | object |
push | Push a Docker image to a registry | object |
inspect | Return low-level information on a container or image | object |
stats | Display container resource usage statistics | object |
network | Manage Docker networks | object |
volume | Manage Docker volumes | object |
Functions
ps
List Docker containers
Module: docker | Returns: object -- API response.
docker.ps
| Parameter | Type | Required | Description |
|---|---|---|---|
all | boolean | No | Show all containers including stopped (default: true) |
format | string | No | Output format: json or table (default: json) |
images
List Docker images
Module: docker | Returns: object -- API response.
docker.images
| Parameter | Type | Required | Description |
|---|---|---|---|
format | string | No | Output format: json or table (default: json) |
run
Run a new container from an image
Module: docker | Returns: object -- API response.
docker.run
| Parameter | Type | Required | Description |
|---|---|---|---|
image | string | Yes | Image name to run |
options | object | No | Run options: detach, rm, name, ports[], env{}, volumes[], network, command |
stop
Stop a running container
Module: docker | Returns: object -- API response.
docker.stop
| Parameter | Type | Required | Description |
|---|---|---|---|
container | string | Yes | Container ID or name |
timeout | number | No | Seconds to wait before killing |
start
Start a stopped container
Module: docker | Returns: object -- API response.
docker.start
| Parameter | Type | Required | Description |
|---|---|---|---|
container | string | Yes | Container ID or name |
rm
Remove a container
Module: docker | Returns: object -- API response.
docker.rm
| Parameter | Type | Required | Description |
|---|---|---|---|
container | string | Yes | Container ID or name |
force | boolean | No | Force remove running container |
volumes | boolean | No | Remove associated volumes |
rmi
Remove a Docker image
Module: docker | Returns: object -- API response.
docker.rmi
| Parameter | Type | Required | Description |
|---|---|---|---|
image | string | Yes | Image ID or name |
force | boolean | No | Force remove |
logs
Fetch logs from a container
Module: docker | Returns: object -- API response.
docker.logs
| Parameter | Type | Required | Description |
|---|---|---|---|
container | string | Yes | Container ID or name |
tail | number | No | Number of lines from the end |
follow | boolean | No | Follow log output |
exec
Execute a command inside a running container
Module: docker | Returns: object -- API response.
docker.exec
| Parameter | Type | Required | Description |
|---|---|---|---|
container | string | Yes | Container ID or name |
command | string | Yes | Command to execute |
interactive | boolean | No | Interactive mode with TTY |
workdir | string | No | Working directory inside container |
build
Build a Docker image from a Dockerfile
Module: docker | Returns: object -- API response.
docker.build
| Parameter | Type | Required | Description |
|---|---|---|---|
context | string | Yes | Build context path |
options | object | No | Build options: tag, file, noCache, buildArgs{} |
pull
Pull a Docker image from a registry
Module: docker | Returns: object -- API response.
docker.pull
| Parameter | Type | Required | Description |
|---|---|---|---|
image | string | Yes | Image name with optional tag |
push
Push a Docker image to a registry
Module: docker | Returns: object -- API response.
docker.push
| Parameter | Type | Required | Description |
|---|---|---|---|
image | string | Yes | Image name with optional tag |
inspect
Return low-level information on a container or image
Module: docker | Returns: object -- API response.
docker.inspect
| Parameter | Type | Required | Description |
|---|---|---|---|
target | string | Yes | Container or image ID/name |
format | string | No | Go template format string |
stats
Display container resource usage statistics
Module: docker | Returns: object -- API response.
docker.stats
| Parameter | Type | Required | Description |
|---|---|---|---|
container | string | No | Container ID or name (omit for all) |
network
Manage Docker networks
Module: docker | Returns: object -- API response.
docker.network
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | No | Action: ls, create, rm, inspect (default: ls) |
name | string | No | Network name |
driver | string | No | Network driver (for create) |
volume
Manage Docker volumes
Module: docker | Returns: object -- API response.
docker.volume
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | No | Action: ls, create, rm, inspect (default: ls) |
name | string | No | Volume name |
driver | string | No | Volume driver (for create) |
Error Handling
All functions throw on failure. Common errors:
| Error | Cause |
|---|---|
| (standard errors) | Check function parameters and authentication |
@desc "Ps and validate result"
do
set $result as docker.ps
if $result != null
print "Success"
else
print "No result"
end
enddo
Recipes
1. Multi-step Docker workflow
Chain multiple docker operations together.
@desc "Ps, images, and more"
do
set $r_ps as docker.ps
set $r_images as docker.images
set $r_run as docker.run
print "All operations complete"
enddo
2. Safe ps with validation
Check results before proceeding.
@desc "Ps and validate result"
do
set $result as docker.ps
if $result != null
print "Success: " + $result
else
print "Operation returned no data"
end
enddo
Related Modules
- git -- Git module for complementary functionality
- github -- GitHub module for complementary functionality
- gitlab -- GitLab module for complementary functionality
- vercel -- Vercel module for complementary functionality
- netlify -- Netlify module for complementary functionality
Versions (1)
| Version | Tag | Published |
|---|---|---|
| 0.1.1 | latest | 1 months ago |
Related Modules
github
JS@robinpathv0.1.1
GitHub module for RobinPath.
bitbucket
JS@robinpathv0.1.2
Bitbucket module for RobinPath.
box
JS@robinpathv0.1.2
Box module for RobinPath.
cache
JS@robinpathv0.1.2
In-memory key-value cache with optional TTL expiration for temporary data storage
$ robinpath add @robinpath/docker
