Docker 2 Docker-Compose
d2dc converts a docker run
-command into a docker-compose service (see 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"
If you have Go installed, you can use the following command to get d2dc:
go install github.com/darmiel/d2dc/cmd/d2dc@latest
- Go 1.15+
- Git (or just download the tarball here)
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
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.