|
|
||
|---|---|---|
| build_logs | ||
| README.md | ||
| build.sh | ||
| go.mod | ||
| go.sum | ||
| install.sh | ||
| main.go | ||
| test.sh | ||
README.md
Here’s the updated README.md documentation tailored for the go-compose-exporter package, reflecting its purpose and usage:
Go Compose Exporter
Go Compose Exporter is a command-line utility designed to help you recover a lost docker-compose.yml file by reverse engineering an existing Docker environment. It extracts configurations from running containers that were started with Docker Compose or Docker Swarm, making it easier to recreate or modify existing deployments without relying on the original docker-compose.yml file.
Installation
To install the binary locally, use the provided installation script. Run the following command in your terminal:
curl -sSL https://git.nixc.us/Nixius/go-compose-exporter/raw/branch/master/install.sh | bash
This will download and install the Go Compose Exporter binary to your local machine.
Usage
The Go Compose Exporter can be used to list all available Docker Compose projects and Docker Swarm stacks, or to export a specific project/stack configuration to a docker-compose.yml file.
List Available Stacks or Projects
To list all available Docker Compose projects and Docker Swarm stacks:
go-compose-exporter
This command will print a list of available projects/stacks that can be exported.
Export a Specific Stack or Project
To export the configuration of a specific Docker Compose project or Docker Swarm stack to a docker-compose.yml file:
go-compose-exporter -s <stack_name> -o <output_file>
Replace <stack_name> with the name of the stack or project you want to export, and <output_file> with the desired output file name.
Example
To export a Docker Compose project named salt to a file named salt-docker-compose.yml:
go-compose-exporter -s salt -o salt-docker-compose.yml
If no output file is specified, the default output file will be docker-compose.yml.
Configuration Options
-s: Specify the stack or project name to export.-o: Specify the output file for the YAML configuration (default isdocker-compose.yml).
How It Works
Go Compose Exporter inspects running Docker containers and extracts their configurations, such as images, environment variables, ports, volumes, and network settings. It identifies Docker Compose projects using the com.docker.compose.project label and Docker Swarm stacks using the com.docker.stack.namespace label.
Use Cases
- Recovering a lost
docker-compose.yml: If you lose your originaldocker-compose.ymlfile, this tool can help you recreate it from your running Docker environment. - Reverse engineering: When dealing with a complex or poorly documented Docker setup, use Go Compose Exporter to generate a usable
docker-compose.ymlfile. - Migrating from Docker Swarm to Docker Compose: Easily export your Docker Swarm stacks to Docker Compose files for simpler management and scaling.
Notes
- Go Compose Exporter requires Docker to be installed and running.
- The tool must be run with appropriate permissions to access Docker and inspect container configurations.