English | 简体中文
Docker Manager is a Docker management API service developed in Go, providing rich interfaces for managing containers, images, networks, and more. It supports automated operations and management of Docker via HTTP API.
- Image Management: Pull, delete, search, view image information
- Container Management: Start, stop, restart, delete, run new containers, get container info, fetch logs, fuzzy search
- Network Management: Create, delete, connect, disconnect networks, get network info
- Interactive Sessions: Create interactive TTY sessions, execute commands, get output, close sessions
- File Operations: Copy files between containers and host
- Resource Management: Dynamically adjust container resources (CPU/memory)
- Docker Info Query: Version, system info, running containers, all container list
- Compose Support: Batch deploy containers via docker-compose file
- Trivy Vulnerability Scan Support (partial)
- Token Whitelist Authentication (optional)
Docker should be installed and running on your system, and the user running this service must have Docker permissions.
- Download the latest binary from the Release page
- Grant execute permission:
chmod +x docker-manager
- Token authentication (optional):
Create a
tokens.txtfile in the same directory to enable token whitelist authentication. - Switch to root or a user with Docker access, then start the service:
sudo su # switch to root ./docker-manager --ip 127.0.0.1 --port 15000
- Create and switch to the docker-manager directory:
mkdir docker-manager cd docker-manager - Download the
docker-compose.ymlfile and edit as needed:wget https://raw.githubusercontent.com/DullJZ/docker-manager/refs/heads/main/docker-compose.yml nano docker-compose.yml
- (Optional) Create and edit
tokens.txtto add your token:echo "your_token" > tokens.txt
- Start the service:
The service will listen on port 15000 by default.
docker-compose up -d
- Install dependencies (Docker environment required locally)
go mod tidy
- Token authentication (optional):
Create a
tokens.txtfile in the same directory to enable token whitelist authentication. - Start the service:
go run api.go funcs.go # Or build and run go build -o docker-manager api.go funcs.go ./docker-manager --ip 127.0.0.1 --port 15000
All endpoints support POST/GET requests. Some require the Authorization header (if token validation is enabled).
POST /api/pull_imagePull imagePOST /api/delete_imageDelete imagePOST /api/list_imagesList imagesPOST /api/search_imageFuzzy search images
GET /api/get_docker_infoDocker infoGET /api/get_docker_versionDocker version
POST /api/run_containerCreate and run containerPOST /api/delete_containerDelete containerPOST /api/start_containerStart containerPOST /api/stop_containerStop containerPOST /api/restart_containerRestart containerPOST /api/fetch_container_infoGet container detailsPOST /api/fetch_container_logsGet container logsPOST /api/search_containerFuzzy search containersGET /api/get_running_containersList running containersGET /api/get_all_containersList all containersPOST /api/update_containerDynamically adjust container resources
POST /api/create_networkCreate networkPOST /api/delete_networkDelete networkGET /api/list_networksList networksPOST /api/network_infoNetwork detailsPOST /api/connect_networkConnect container to networkPOST /api/disconnect_networkDisconnect container from network
POST /api/copy_from_containerCopy file from container to hostPOST /api/copy_to_containerCopy file from host to container
POST /api/create_exec_sessionCreate interactive sessionPOST /api/execute_command_in_sessionExecute command in sessionPOST /api/get_more_session_outputGet more session outputPOST /api/close_exec_sessionClose session
POST /api/run_container_by_composeBatch deploy containers via docker-compose file
Create a tokens.txt file in the project root directory, one token per line (supports comments and blank lines). If the file does not exist, authentication is disabled and all requests are allowed.
- Go 1.18+
- Docker environment
- Main libraries: gin, docker/docker, lithammer/fuzzysearch, gopsutil