/install docker-cli
\r \r
Docker CLI Helper\r
\r This skill explains how to use the Docker command line for common container workflows.\r \r
When to Use\r
\r Use this skill when:\r \r
- The user wants to build or rebuild a Docker image.\r
- The user wants to run a container (one-off or long-running).\r
- The user wants to see which containers/images/volumes exist.\r
- The user wants to stop or remove containers/images.\r
- The user wants to see logs, exec into a container, or check resource usage.\r \r
Requirements\r
\r
- Docker is installed and running.\r
docker versionordocker infoworks in the user’s shell.\r \r If unsure, suggest the user run:\r \r
docker version\r
```\r
\r
to confirm Docker is available.\r
\r
## Safety Guidelines\r
\r
- Prefer **read-only** or non-destructive commands first:\r
- `docker ps`, `docker ps -a`\r
- `docker images`\r
- `docker logs`\r
- `docker inspect`\r
- Be cautious with destructive commands:\r
- `docker rm`, `docker rmi`\r
- `docker system prune`\r
- `docker volume rm`\r
- Only recommend destructive cleanups when the user explicitly wants to free resources and understands what will be removed.\r
\r
## Common Workflows\r
\r
### 1. List and inspect containers\r
\r
List running containers:\r
\r
```bash\r
docker ps\r
```\r
\r
List all containers (including stopped):\r
\r
```bash\r
docker ps -a\r
```\r
\r
Inspect a container in detail:\r
\r
```bash\r
docker inspect \x3Ccontainer-id-or-name>\r
```\r
\r
### 2. List and inspect images\r
\r
List local images:\r
\r
```bash\r
docker images\r
```\r
\r
Inspect an image:\r
\r
```bash\r
docker inspect \x3Cimage-id-or-name>\r
```\r
\r
### 3. Build images\r
\r
Build an image from a `Dockerfile` in the current directory:\r
\r
```bash\r
docker build -t \x3Cimage-name>:\x3Ctag> .\r
```\r
\r
Example:\r
\r
```bash\r
docker build -t my-app:latest .\r
```\r
\r
If the `Dockerfile` is in another directory:\r
\r
```bash\r
docker build -t my-app:latest path/to/context\r
```\r
\r
### 4. Run containers\r
\r
Run a container in the foreground:\r
\r
```bash\r
docker run --rm -it \x3Cimage-name>:\x3Ctag>\r
```\r
\r
Run in detached mode (background service):\r
\r
```bash\r
docker run -d --name \x3Ccontainer-name> \x3Cimage-name>:\x3Ctag>\r
```\r
\r
Map ports from container to host:\r
\r
```bash\r
docker run -d --name \x3Ccontainer-name> -p 8080:80 \x3Cimage-name>:\x3Ctag>\r
```\r
\r
Mount a host directory into the container:\r
\r
```bash\r
docker run -d --name \x3Ccontainer-name> -v /host/path:/container/path \x3Cimage-name>:\x3Ctag>\r
```\r
\r
### 5. Stop and remove containers\r
\r
Stop a running container:\r
\r
```bash\r
docker stop \x3Ccontainer-id-or-name>\r
```\r
\r
Remove a stopped container:\r
\r
```bash\r
docker rm \x3Ccontainer-id-or-name>\r
```\r
\r
Stop and remove in one shot (two commands):\r
\r
```bash\r
docker stop \x3Ccontainer-id-or-name>\r
docker rm \x3Ccontainer-id-or-name>\r
```\r
\r
### 6. Remove images\r
\r
Remove an image by ID or name:\r
\r
```bash\r
docker rmi \x3Cimage-id-or-name>\r
```\r
\r
Only suggest this when the user is sure the image is no longer needed.\r
\r
### 7. Logs and exec\r
\r
See logs for a container:\r
\r
```bash\r
docker logs \x3Ccontainer-id-or-name>\r
```\r
\r
Stream logs (follow):\r
\r
```bash\r
docker logs -f \x3Ccontainer-id-or-name>\r
```\r
\r
Execute a shell inside a running container (if it has `/bin/bash`):\r
\r
```bash\r
docker exec -it \x3Ccontainer-id-or-name> /bin/bash\r
```\r
\r
or with `/bin/sh`:\r
\r
```bash\r
docker exec -it \x3Ccontainer-id-or-name> /bin/sh\r
```\r
\r
### 8. Clean up resources\r
\r
Only suggest these when the user explicitly wants cleanup:\r
\r
- Remove all stopped containers:\r
\r
```bash\r
docker container prune\r
```\r
\r
- Remove unused images:\r
\r
```bash\r
docker image prune\r
```\r
\r
- Remove everything unused (containers, networks, images, and optionally volumes):\r
\r
```bash\r
docker system prune\r
```\r
\r
For a more aggressive cleanup, but only if the user confirms:\r
\r
```bash\r
docker system prune -a\r
```\r
\r
## Troubleshooting Tips\r
\r
- If images cannot be pulled, check:\r
- Network connectivity.\r
- Registry authentication (if using a private registry).\r
- If ports are already in use, suggest:\r
- Changing the host port in `-p host:container`.\r
- Or stopping the process that currently uses the port.\r
- If a container keeps exiting immediately:\r
- Suggest checking `docker logs \x3Ccontainer>` for errors.\r
- Inspect entrypoint and command configuration.\r
\r
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install docker-cli - After installation, invoke the skill by name or use
/docker-cli - Provide required inputs per the skill's parameter spec and get structured output
What is Docker Cli?
Helper for using the Docker CLI to build, run, stop, inspect, and manage containers and images. Use when the user wants to perform container-related tasks fr... It is an AI Agent Skill for Claude Code / OpenClaw, with 332 downloads so far.
How do I install Docker Cli?
Run "/install docker-cli" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Docker Cli free?
Yes, Docker Cli is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does Docker Cli support?
Docker Cli is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Docker Cli?
It is built and maintained by openlang (@openlang-cn); the current version is v1.0.0.