Tool to convert docker-compose files to set of simple docker commands

Overview

docker-decompose

Tool to convert docker-compose files to set of simple docker commands.

icon

Install

Use go get to install the latest version of the library.

go get -u github.com/reallyliri/docker-decompose

Usage

NAME:
   docker-decompose - Decompose docker compose files to docker build and run commands
USAGE:
   docker-decompose [Options] [compose-file] [service, ...]
ARGS:
    compose-file  path to a docker-compose.yaml file, defaults to docker-compose.yaml at current directory
    service(s)    zero or more service names to decompose, defaults to all services in the compose file
OPTIONS:
   --no-build                 Skip printing docker-build commands (default: false)
   --no-run                   Skip printing docker-run commands (default: false)
   --no-network               Skip printing docker-network-create commands (default: false)
   --no-env-inherit           Don't pass on external environment variables (default: false)
   --env value, -e value      Path to env file to apply when rendering compose, will be skipped if does not exist (default: ".env")
   --restart value, -r value  Restart flag to pass to docker-run command, one of [no, always, on-failure, unless-stopped]. If not specified, will be taken from compose
   --help, -h                 show help (default: false)
   --version, -v              print the version (default: false)

Examples

docker-decompose my-compose.yaml svc-1 svc-2
docker-decompose --restart unless-stopped --env ~/.env

Output for given compose files:


version: "3"
services:
  web:
    build: .
    ports:
      - "5000:5000"
    volumes:
      - .:/code
    environment:
      FLASK_ENV: development
  redis:
    image: "redis:alpine"

===>

docker build -f "Dockerfile" -t "web" .

docker run -n "web" -e "FLASK_ENV=development" -p "5000:5000" -v ".:/code" "web"

docker run -n "redis" "redis:alpine"

version: "3"
services:
    postgres_triple:
        container_name: postgres_triple
        image: postgres:9.5
        volumes:
            - pgdata_triple:/var/lib/postgresql/data
        environment:
            - POSTGRES_PASSWORD=postgres
        networks:
            - db-net
    postgres:
        container_name: postgres
        image: postgres:9.5
        volumes:
            - pgdata:/var/lib/postgresql/data
        environment:
            - POSTGRES_PASSWORD=postgres
        networks:
            - db-net
    collectiwise:
        container_name: collectiwise
        build: .
        image: collectiwise/main:${COLL_TAG}
        ports:
            - "8090:80"
        environment:
            - COLLECTIWISE_BRANCH=${BRANCH}
        networks:
            - db-net
volumes:
    pgdata:
    pgdata_triple:
      driver_opts:
        o: bind
        type: none
        device: "/var/pgdata/triple"

networks:
  db-net:

with .env file containing BRANCH=dev COLL_TAG=l4t3st

===>

docker network create db-net

docker build -f "Dockerfile" -t "collectiwise/main:l4t3st" .

docker run -n "collectiwise" -e "COLLECTIWISE_BRANCH=dev" --network "db-net" -p "8090:80" "collectiwise/main:l4t3st"

docker run -n "postgres_triple" -e "POSTGRES_PASSWORD=postgres" --network "db-net" -v "/var/pgdata/triple:/var/lib/postgresql/data" "postgres:9.5"

docker run -n "postgres" -e "POSTGRES_PASSWORD=postgres" --network "db-net" -v "pgdata:/var/lib/postgresql/data" "postgres:9.5"
You might also like...
Sample multi docker compose environment setup

Instructions This is a demonstration of a Multi Docker Compose. The purpose of this repositoy is ongoing research on "Docker compose" architecture des

Example used to try a compose application with Docker Dev Environments

compose-dev-env Example used to try a Compose application with Docker Dev Environments. This example is based on the nginx-golang-mysql sample of awes

GitHub Action: Compose multiple (conditional) checks into a single check based on file paths in a pull request
GitHub Action: Compose multiple (conditional) checks into a single check based on file paths in a pull request

GitHub Action: Composite Example Usage --- name: All Checks on: pull_request: branches: - main jobs: meta: runs-on: - ubuntu-20.

Bubbleboxer - compose bubbles into boxes

bubbleboxer 🥊 - compose bubbles into boxes 📦 A way to compose multiple bubbles

Template Compose - Continues Delivery

Template Compose - Continues Delivery

This repo includes several winrm applications like transfering files, running commands.
This repo includes several winrm applications like transfering files, running commands.

WinRM Tools This repo includes several WinRM tools written with Go: File transfering between two Powershell session. Running command on remote Powersh

ecsk is a CLI tool to interactively use frequently used functions of docker command in Amazon ECS. (docker run, exec, cp, logs, stop)
ecsk is a CLI tool to interactively use frequently used functions of docker command in Amazon ECS. (docker run, exec, cp, logs, stop)

English / 日本語 ecsk ECS + Task = ecsk 😆 ecsk is a CLI tool to interactively use frequently used functions of docker command in Amazon ECS. (docker run

Go-http-server-docker - Simple sample server using docker and go

go-http-server-docker Simple sample webserver using docker and go.

DepCharge is a tool designed to help orchestrate the execution of commands across many directories at once.

DepCharge DepCharge is a tool that helps orchestrate the execution of commands across the many dependencies and directories in larger projects. It als

Owner
Liri S
Liri S
Mutagen Compose is a modified version of Docker Compose that offers automated integration with Mutagen.

Mutagen Compose Mutagen Compose is a (minimally) modified version of Docker Compose that offers automated integration with Mutagen. This allows you to

Mutagen 81 Dec 22, 2022
Dotnet-appsettings-env - Convert .NET appsettings.json file to Kubernetes, Docker and Docker-Compose environment variables

dotnet-appsettings-env Convert .NET appsettings.json file to Kubernetes, Docker

Daniel Dias de Assumpção 18 Dec 30, 2022
Dotnet-appsettings-env - Convert .NET appsettings.json file to Kubernetes, Docker and Docker-Compose environment variables

dotnet-appsettings-env Convert .NET appsettings.json file to Kubernetes, Docker

Daniel Dias de Assumpção 1 Feb 16, 2022
Easily run your Compose application to the cloud with compose-cli

This CLI tool makes it easy to run Docker containers and Docker Compose applications in the cloud using either Amazon Elastic Container Service (ECS) or Microsoft Azure Container Instances (ACI) using the Docker commands you already know.

Docker 889 Jan 8, 2023
Execute multiple shell commands like Docker-Compose

parx parx is a simple tool to run multiple commands in parallel while having the output structured like Docker Compose does that. This is useful when

Tobias B. 8 Aug 15, 2022
Katenary - Convert docker-compose to a configurable helm chart

Katenary is a tool to help transforming docker-compose files to a working Helm C

Patrice Ferlet 40 Dec 23, 2022
Hassle-free minimal CI/CD for git repositories with docker or docker-compose projects.

GIT-PIPE Hassle-free minimal CI/CD for git repos for docker-based projects. Features: zero configuration for repos by default automatic encrypted back

Aleksandr Baryshnikov 50 Sep 23, 2022
Mesos Framework to use docker-compose files.

mesos-compose Mesos Framework to use docker-compose files. Requirements Apache Mesos min 1.6.0 Mesos with SSL and Authentication is optional Redis Dat

AVENTER UG (haftungsbeschränkt) 2 Dec 14, 2022
Docker-compose files for running full Storj network locally

docker-compose based Storj environment storj-up is a swiss-army tool to create / customize Storj clusters with the help of docker-compose (not just st

Storj 17 Nov 16, 2022
Go package exposing a simple interface for executing commands, enabling easy mocking and wrapping of executed commands.

go-runner Go package exposing a simple interface for executing commands, enabling easy mocking and wrapping of executed commands. The Runner interface

Krystal 7 Oct 18, 2022