Go to file
Colin b18dab5b49 retry 2024-08-29 11:22:58 -04:00
build_logs reupload 2024-08-29 10:55:54 -04:00
dist retry 2024-08-29 11:22:58 -04:00
README.md safe language 2024-08-29 10:59:13 -04:00
build.sh reupload 2024-08-29 10:28:39 -04:00
go.mod corrected repo name on fs and rebuilt 2024-08-29 11:01:42 -04:00
go.sum reupload 2024-08-29 10:55:54 -04:00
install.sh safe language 2024-08-29 10:59:13 -04:00
main.go retry 2024-08-29 11:22:58 -04:00
test.sh reupload 2024-08-29 10:28:39 -04:00

README.md

Heres 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/main/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 is docker-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 original docker-compose.yml file, 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.yml file.
  • 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.