Skip to content

darmiel/d2dc

Repository files navigation

d2dc

Docker 2 Docker-Compose

v r Test Go Build


d2dc converts a docker run-command into a docker-compose service (see example). example-img



Example

INPUT:

$ docker run -it --rm --name ftp -p 21:21 -e "HELLO=WORLD" -v "${PWD}/data":/data myimage:latest

OUTPUT:

services:
  ftp:
    image: myimage:latest
    stdin_open: true
    tty: true
    environment:
      HELLO: WORLD
    volumes:
    - ./data:/data
    ports:
    - "21:21"

Installation

If you have Go installed, you can use the following command to get d2dc:

go install github.com/darmiel/d2dc/cmd/d2dc@latest

Build

Prerequisites

  • Go 1.15+
  • Git (or just download the tarball here)

Build

Build builds the project and outputs the executable file in the root folder

$ git clone https://github.com/darmiel/d2dc
$ cd d2dc
$ go build ./cmd/d2dc

# (optional): Install to path:
$ go install ./cmd/d2dc

Why?

I wanted to learn a bit of the commands for docker run and so I thought this would be a good project to learn those commands.