Convert your docker run commands to docker-compose.yml files

[https://bucherfa.github.io/dcc-web/](https://bucherfa.github.io/dcc-web/)

Tool I build to convert docker run commands to a docker-compose.yml file.

input:

docker run -d \
--name=firefly_iii_db \
-e POSTGRES_PASSWORD=firefly \
-e POSTGRES_USER=firefly \
-v firefly_iii_db:/var/lib/postgresql/data \
postgres:10

docker run -d \
--name=firefly_iii_app \
--link=firefly_iii_db \
-e FF_DB_HOST=firefly_iii_db \
-e FF_DB_CONNECTION=pgsql \
-e FF_DB_NAME=firefly \
-e FF_DB_USER=firefly \
-e FF_DB_PASSWORD=firefly \
-e FF_APP_KEY=S0meRandomStr1ngOf32CharsExactly \
-e FF_APP_ENV=local \
-p 80:80 \
-v firefly_iii_export:/var/www/firefly-iii/storage/export \
-v firefly_iii_upload:/var/www/firefly-iii/storage/upload \
jc5x/firefly-iii

docker-compose.yml

version: '3'
services:
firefly_iii_db:
container_name: firefly_iii_db
image: 'postgres:10'
environment:
- POSTGRES_PASSWORD=firefly
- POSTGRES_USER=firefly
volumes:
- 'firefly_iii_db:/var/lib/postgresql/data'
firefly_iii_app:
container_name: firefly_iii_app
image: jc5x/firefly-iii
environment:
- FF_DB_HOST=firefly_iii_db
- FF_DB_CONNECTION=pgsql
- FF_DB_NAME=firefly
- FF_DB_USER=firefly
- FF_DB_PASSWORD=firefly
- FF_APP_KEY=S0meRandomStr1ngOf32CharsExactly
- FF_APP_ENV=local
volumes:
- 'firefly_iii_export:/var/www/firefly-iii/storage/export'
- 'firefly_iii_upload:/var/www/firefly-iii/storage/upload'
ports:
- '80:80'
links:
- firefly_iii_db

example from [firefly docu](https://docs.firefly-iii.org/en/latest/installation/docker.html#run-command)

[first posted](https://www.reddit.com/r/selfhosted/comments/c11ogh/tool_i_build_to_convert_docker_run_commands_to_a/) on r/selfhosted

8 thoughts on “Convert your docker run commands to docker-compose.yml files”

  1. Thank you not only for making this open source but accessible without me having to use node package manager to get that weird package that I’ve been using.

    Reply
  2. I’m a bot, *bleep*, *bloop*. Someone has linked to this thread from another place on reddit:

    – [/r/u_colinhines] [Convert your docker run commands to docker-compose.yml files](https://www.reddit.com/r/u_colinhines/comments/c1ikdu/convert_your_docker_run_commands_to/)

     *^(If you follow any of the above links, please respect the rules of reddit and don’t vote in the other threads.) ^\([Info](/r/TotesMessenger) ^/ ^[Contact](/message/compose?to=/r/TotesMessenger))*

    Reply
  3. Great works. But the following command seems not to work properly.

    docker run -dit \\

    \–name debug \\

    \-e HOST\_USER\_NAME=$USER \\

    \-e HOST\_USER\_ID=\`id -u\` \\

    \–runtime=nvidia \\

    \–privileged=true \\

    \-v /test:/test \\

    \–rm –ipc=host \\

    ubuntu /bin/bash

    Reply
  4. Fantastic work! Question: would it be possible to convert in the opposite direction? `docker-compose.yml` -> the equivalent docker command?

    Use case (for me): I use compose for developing apps, and I’m aware `docker-compose` is less than I deal for deployment, best practice being to use the `docker` command in production. However, I currently lack the knowledge to fully translate my compose files to CLI.

    Reply

Leave a Comment