Coder Social home page Coder Social logo

billblight / docker-autocompose Goto Github PK

View Code? Open in Web Editor NEW

This project forked from red5d/docker-autocompose

0.0 0.0 0.0 54 KB

(Just so I don't loose it) Generate a docker-compose yaml definition from a running container

Python 98.05% Dockerfile 1.95%

docker-autocompose's Introduction

docker-autocompose

Generates a docker-compose yaml definition from a docker container.

Required Modules:

Example Usage:

sudo python autocompose.py <container-name-or-id>

Generate a compose file for multiple containers together:

sudo python autocompose.py apache-test mysql-test

The script defaults to outputting to compose file version 3, but use "-v 1" to output to version 1:

sudo python autocompose.py -v 1 apache-test

Outputs a docker-compose compatible yaml structure:

docker-compose reference

docker-compose yaml file specification

While experimenting with various docker containers from the Hub, I realized that I'd started several containers with complex options for volumes, ports, environment variables, etc. and there was no way I could remember all those commands without referencing the Hub page for each image if I needed to delete and re-create the container (for updates, or if something broke).

With this tool, I can easily generate docker-compose files for managing the containers that I've set up manually.

Docker Usage

You can use this tool from a docker container by either cloning this repo and building the image or using the automatically generated image on GitHub

Pull the image from GitHub (supports both x86 and ARM)

docker pull ghcr.io/red5d/docker-autocompose:latest

Use the new image to generate a docker-compose file from a running container or a list of space-separated container names or ids:

docker run --rm -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/red5d/docker-autocompose <container-name-or-id> <additional-names-or-ids>...

To print out all containers in a docker-compose format:

docker run --rm -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/red5d/docker-autocompose $(docker ps -aq)

Contributing

When making changes, please validate the output from the script by writing it to a file (docker-compose.yml or docker-compose.yaml) and running "docker-compose config" in the same folder with it to ensure that the resulting compose file will be accepted by docker-compose.

docker-autocompose's People

Contributors

acdoussan avatar akshaysalunke13 avatar alpex8 avatar demon avatar docwhat avatar doob187 avatar fmotrifork avatar galaxy102 avatar hgghyxo avatar lunaticmuch avatar moschlar avatar ostafen avatar red5d avatar rootrider avatar smokes2345 avatar yeyeto2788 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.