GithubHelp home page GithubHelp logo

composerize / composerize Goto Github PK

View Code? Open in Web Editor NEW
2.9K 18.0 199.0 2.57 MB

🏃→🎼 docker run asdlksjfksdf > docker-composerize up

Home Page: http://composerize.com

JavaScript 94.08% Makefile 0.85% HTML 2.91% CSS 1.29% Shell 0.87%
docker docker-compose dockerfile

composerize's Introduction

composerize

Build Status npm Follow @mark_larah ShareVB on GitHub

http://composerize.com - Turns docker run commands into docker-compose.yml files and even merge with existing docker-compose.yml!

Looking for the reverse : http://decomposerize.com / Decomposerize

Want to convert from Docker compose file formats : http://composeverter.com / Composeverter

Demo

CLI

composerize can be run in the cli.

npm install composerize -g to install, and run as such:

$ composerize docker run -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro --restart always --log-opt max-size=1g nginx

See composerize --help for more options.

How to use with node.js

Make sure to install the composerize package in your project by running:

npm install composerize

With the following code, you can easily integrate Composerize into your Node.js project and generate Docker Compose configurations from Docker run commands.

const composerize = require('composerize');

const dockerRunCommand = 'docker run -d -p 8080:80 --name my-web-app nginx:latest';

// Convert the Docker run command to a Docker Compose configuration
const composeConfig = composerize(dockerRunCommand);

console.log(composeConfig);

You can also merge docker run command(s) with an existing Docker Compose file content :

const composerize = require('composerize');

const dockerRunCommand = 'docker run -d -p 8080:80 --name my-web-app nginx:latest';

// An existing Docker Compose configuration as a string
const existingComposeConfig = `
version: '3'
services:
  existing-service:
    image: my-existing-image:latest
    ports:
      - '8000:80'
`;

// Convert the Docker run command to a Docker Compose configuration and merge with provided docker compose
const composeConfig = composerize(dockerRunCommand, existingComposeConfig);

console.log(composeConfig);

You can also choose which version of Docker compose V2, you target : 2.x, 3.x or Common Specification by specifying a third parameter composeVersion on convertDockerRunToCompose :

  • 'v2x'
  • 'v3x'
  • 'latest'
const composerize = require('composerize');

const dockerRunCommand = 'docker run -d -p 8080:80 --name my-web-app nginx:latest';

// Convert the Docker run command to a Docker Compose configuration for 2.x
const composeConfig = composerize(dockerRunCommand, null, 'v2x');

console.log(composeConfig);

You can also choose indentation level by specifying a fourth parameter indent on convertDockerRunToCompose :

  • 'v2x'
  • 'v3x'
  • 'latest'
const composerize = require('composerize');

const dockerRunCommand = 'docker run -d -p 8080:80 --name my-web-app nginx:latest';

// Convert the Docker run command to a Docker Compose configuration for 2.x
const composeConfig = composerize(dockerRunCommand, null, 'latest', 2);

console.log(composeConfig);

Contributing

  • Clone a fork of the repo and install the project dependencies by running yarn
  • Make your changes, and build the project by running make build
  • Test your changes with make test

Maintainers

composerize's People

Contributors

danshilm avatar dependabot-preview[bot] avatar greenkeeper[bot] avatar inakiabt avatar jcgoette avatar jdb8 avatar jenkins10891 avatar magicmark avatar sharevb avatar sithladyraven avatar sonicwarrior1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

composerize's Issues

-c parameter's content doesn't seems to be recognized inside entrypoint

Do you want to request a feature or report a bug?

  • feature request
  • bug report

Please provide a sample input docker run command

docker run -d -p 8080:8080 -v "$PWD/airflow/dags:/opt/airflow/dags/" --entrypoint=/bin/bash --name airflow apache/airflow:2.1.1-python3.8 -c '(airflow db init && airflow users create --username admin --password stack --firstname Felipe --lastname Lastname --role Admin --email [email protected]); airflow webserver & airflow scheduler'

Content of -c parameter doesn't seems to be recognized, while it displays only "bin/bash" and forgets all the rest inside -c ''

What is the current output?*

version: '3.3'
services:
    airflow:
        ports:
            - '8080:8080'
        volumes:
            - '$PWD/airflow/dags:/opt/airflow/dags/'
        entrypoint:
            - /bin/bash
        container_name: airflow
        image: 'apache/airflow:2.1.1-python3.8'

What is the expected/desired output?
This is the corrected output, it works fine for me, the container works.

version: '3.3'
services:
    airflow:
        container_name: airflow
        image: 'apache/airflow:2.1.1-python3.8'
        ports:
            - '8080:8080'
        volumes:
            - '$PWD/airflow/dags:/opt/airflow/dags/'
        entrypoint:
            - /bin/bash
            - -ecx
            - |
                airflow db init && airflow users create --username admin --password stack --firstname Felipe --lastname Lastname --role Admin --email [email protected]
                airflow webserver & airflow scheduler

Things I noticed:

missing:

 - /bin/bash
            - -ecx (missing this line for multiple commands)
            - |        (also this one for multiple commands)
            (new line with command sequence)

and everything that comes inside -c.
Also, notice that if we encounter a ; , like in (long command1); command2; command3 we should jump a line, getting in result

        entrypoint:
            - "/bin/bash"
            - -ecx
            - |
                long command1
                command2
                command3

Missing image

Output is missing image what i should use
It's easy to reproduce.
Input

docker run -t --name="youtrack" uniplug/youtrack

Output

version: 3
services:
    youtrack: {}

Expected output

version: 3
services:
    youtrack:
        image: uniplug/youtrack

Network Mode is ignored

Do you want to request a feature or report a bug?
The but is that the --network parameter get's completely ignored as far as I can see.

Please provide a sample input docker run command

docker run \ -d \ --name plex  --network=host \ -e TZ="<timezone>" \ -e PLEX_CLAIM="<claimToken>" \ -v <path/to/plex/database>:/config \ -v <path/to/transcode/temp>:/transcode \ -v <path/to/media>:/data \ plexinc/pms-docker

What is the current output?*

version: 3
services:
    pms-docker:
        container_name: plex
        environment:
            - TZ=<timezone>
            - PLEX_CLAIM=<claimToken>
        volumes:
            - '<path/to/plex/database>:/config'
            - '<path/to/transcode/temp>:/transcode'
            - '<path/to/media>:/data'
        image: plexinc/pms-docker

What is the expected/desired output?

version: 3
services:
    pms-docker:
        container_name: plex
        network_mode: 'host'
        environment:
            - TZ=<timezone>
            - PLEX_CLAIM=<claimToken>
        volumes:
            - '<path/to/plex/database>:/config'
            - '<path/to/transcode/temp>:/transcode'
            - '<path/to/media>:/data'
        image: plexinc/pms-docker

Does not support parametrized containers

for example docker run -d -P -v /var/log:/log mthenw/frontail /log/syslog
is parsed incorrectly , also try with

docker run --name="logspout" --volume=/var/run/docker.sock:/var/run/docker.sock \ gliderlabs/logspout syslog+tls://logs.papertrailapp.com:55555

Commands after the image does not work.

Looks like a bug.

Example:

docker run --rm -it -p 50000:50000 -p 8080:8080 --name opcplc mcr.microsoft.com/iotedge/opc-plc:latest --pn=50000 --autoaccept --nospikes --nodips --nopostrend --nonegtrend --nodatavalues --sph --sn=25 --sr=10 --st=uint --fn=5 --fr=1 --ft=uint

What is the current output?*

version: '3.3'
services:
    iotedge:
        ports:
            - '50000:50000'
            - '8080:8080'
        container_name: opcplc
        image: 'mcr.microsoft.com/iotedge/opc-plc:latest'

What is the expected/desired output?

version: '3.3'
services:
    iotedge:
        ports:
            - '50000:50000'
            - '8080:8080'
        container_name: opcplc
        image: 'mcr.microsoft.com/iotedge/opc-plc:latest'
        args: 
            - '--pn=50000'
            - '--autoaccept'
            - 'and so on...'

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Checkmk - malformed

Do you want to request a feature or report a bug?

Please provide a sample input docker run command https://hub.docker.com/r/checkmk/check-mk-raw/

docker container run -dit -p 8080:5000 --tmpfs /opt/omd/sites/cmk/tmp:uid=1000,gid=1000 -v/omd/sites --name monitoring -v/etc/localtime:/etc/localtime:ro --restart always checkmk/check-mk-raw:2.0.0-latest


What is the current output?*

version: '3.3'
services:
    nginx:
        ports:
            - '80:80'
            - '8080:5000'
        volumes:
            - /var/run/dockerdocker
            - /omd/sites
            - '/etc/localtime:/etc/localtime:ro'
        tmpfs: '/opt/omd/sites/cmk/tmp:uid=1000,gid=1000'
        container_name: monitoring
        restart: 'always,always'
        logging:
            options:
                max-size: 1g
        image: nginx

What is the expected/desired output?

the restart has issue, and the image name is wrong and other attributes 

version should be between apostrophes ''

when you directly copy the resulting compose file and try to run error Version in "./docker-compose.yml" is invalid - it should be a string. is raised due lack of apostrophes in the version section

Will the website ever be updated?

I noticed the code has support for the --net/--network param, but the website doesn't; is the site ever going to get the latest stuff?

Also, curious to know if anything gets logged on the site? i.e. do all the conversions people do on the site get stored anywhere?

Cloudflared docker run command malformed

Do you want to request a feature or report a bug?
Bug
Please provide a sample input docker run command

docker run cloudflare/cloudflared:2022.3.4 tunnel --no-autoupdate run --token redacted

What is the current output?*

version: '3.3'
services:
    run:
        image: run

What is the expected/desired output?

version: "3.3"
services:
  cloudflared:
    image: "cloudflare/cloudflared:2022.3.4"
    command: tunnel --no-autoupdate run --token redacted

This is the default docker run command given by Cloudflare when trying to setup a tunnel for the their Zero Trust.

Multiple arguments ignoring

Ignoring multiple arguments of same type.
It's easy to reproduce.
Input

docker run -t --name="youtrack"  -v /data/youtrack/data/:/opt/youtrack/data/ -v /data/youtrack/backup/:/opt/youtrack/backup/ -p 80:80 -p 3232:22351 uniplug/youtrack

Output

version: 3
services:
    youtrack:
        volumes:
            - '/data/youtrack/backup/:/opt/youtrack/backup/'
        ports:
            - '3232:22351'

Expected output

version: 3
services:
    youtrack:
        volumes:
            - '/data/youtrack/data/:/opt/youtrack/data/'
            - '/data/youtrack/backup/:/opt/youtrack/backup/'
        ports:
            - '80:80'
            - '3232:22351'

Support for --tty, -t command

I'm trying to convert this command from jwilder/nginx-proxy

docker run --volumes-from nginx \
    -v /var/run/docker.sock:/tmp/docker.sock:ro \
    -v $(pwd):/etc/docker-gen/templates \
    -t jwilder/docker-gen -notify-sighup nginx -watch /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf

And then I have this output

version: '3.3'
services:
    etc:
        volumes:
            - '/var/run/docker.sock:/tmp/docker.sock:ro'
            - '$(pwd):/etc/docker-gen/templates'
        image: /etc/nginx/conf.d/default.conf

Thank's !

support opposite direction

Would be great if this tool could work the opposite direction as well - given a docker-compose file, what would be the docker commands?

Use a proper arg parsing library

We currently use spawn-args, which means that:

  • We still have to do some of our own argument parsing
  • Subtle input differences lead to bugs like #10

Let's either do our own lexing+parsing, or ideally use an existing arg parsing library.

(I started a branch but yargs-parser currently only works in node. Maybe we could PR to remove the node dependencies? Or find an equivalent library?)

Sensitive info

Hi @magicmark
I pasted inadvertently some sensitive info on https://composerize.com

I am wondering if you keep logs of what was posted there, and if you could please delete them. I apologise for this request. I tried to contact you via other channels, email etc, but could not find.
Thank you
Mal

Volume stanza omitted

Do you want to request a feature or report a bug?
BUG

Please provide a sample input docker run command

docker run --restart=unless-stopped -d --name=readymedia1 --net=host -v /my/video/path:/media -v readymediacache:/cache -e VIDEO_DIR1=/media/my_video_files ypopovych/readymedia

What is the current output?*

version: '3.3'
services:
    readymedia:
        restart: unless-stopped
        container_name: readymedia1
        network_mode: host
        volumes:
            - '/my/video/path:/media'
            - 'readymediacache:/cache'
        environment:
            - VIDEO_DIR1=/media/my_video_files
        image: ypopovych/readymedia

What is the expected/desired output?

version: '3.3'
services:
    readymedia:
        restart: unless-stopped
        container_name: readymedia1
        network_mode: host
        volumes:
            - '/my/video/path:/media'
            - 'readymediacache:/cache'
        environment:
            - VIDEO_DIR1=/media/my_video_files
        image: ypopovych/readymedia

volumes:
  readymediacache:

support docker service

** Feature request **

support for converting docker service create

docker service is supported in docker-compose 3 and similar enough syntax to docker run aside from specifying scale

environment parsed not correct

I want to convert a docker run command from https://docs.konghq.com/install/docker/ to docker-compose.yml and I tried https://composerize.com/, but the parsed output seems problematical.

Do you want to request a feature or report a bug?
bug

Please provide a sample input docker run command

docker run -d --name kong \
     --network=kong-net \
     -e "KONG_DATABASE=postgres" \
     -e "KONG_PG_HOST=kong-database" \
     -e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \
     -e "KONG_PROXY_ACCESS_LOG=/dev/stdout" \
     -e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" \
     -e "KONG_PROXY_ERROR_LOG=/dev/stderr" \
     -e "KONG_ADMIN_ERROR_LOG=/dev/stderr" \
     -e "KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl" \
     -p 8000:8000 \
     -p 8443:8443 \
     -p 8001:8001 \
     -p 8444:8444 \
     kong:latest

What is the current output?*

C:\Users\Liu.D.H>composerize docker run -d --name kong --network=kong-net -e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=kong-database" -e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" -e "KONG_PROXY_ACCESS_LOG=/dev/stdout" -e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" -e "KONG_PROXY_ERROR_LOG=/dev/stderr" -e "KONG_ADMIN_ERROR_LOG=/dev/stderr" -e "KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl" -p 8000:8000 -p 8443:8443 -p 8001:8001 -p 8444:8444 kong:latest
version: '3.3'
services:
    kong:
        container_name: kong
        network_mode: kong-net
        environment:
            - KONG_DATABASE=postgres
            - KONG_PG_HOST=kong-database
            - KONG_CASSANDRA_CONTACT_POINTS=kong-database
            - KONG_PROXY_ACCESS_LOG=/dev/stdout
            - KONG_ADMIN_ACCESS_LOG=/dev/stdout
            - KONG_PROXY_ERROR_LOG=/dev/stderr
            - KONG_ADMIN_ERROR_LOG=/dev/stderr
            - 'KONG_ADMIN_LISTEN=0.0.0.0:8001,'
        ports:
            - '8000:8000'
            - '8443:8443'
            - '8001:8001'
            - '8444:8444'
        image: 'kong:latest'

C:\Users\Liu.D.H>

What is the expected/desired output?

version: '3.3'
services:
    kong:
        container_name: kong
        network_mode: kong-net
        environment:
            - KONG_DATABASE=postgres
            - KONG_PG_HOST=kong-database
            - KONG_CASSANDRA_CONTACT_POINTS=kong-database
            - KONG_PROXY_ACCESS_LOG=/dev/stdout
            - KONG_ADMIN_ACCESS_LOG=/dev/stdout
            - KONG_PROXY_ERROR_LOG=/dev/stderr
            - KONG_ADMIN_ERROR_LOG=/dev/stderr
            - KONG_ADMIN_LISTEN='0.0.0.0:8001, 0.0.0.0:8444 ssl'
        ports:
            - '8000:8000'
            - '8443:8443'
            - '8001:8001'
            - '8444:8444'
        image: 'kong:latest'

Option for v2 alongside v3.3

I was wondering whether it would be an option to include a switch for generating docker-compose v2 next to the current v3.3. Few of us use Portainer, which still does not support v3 in its stack unfortunately...

ERROR: Version in "./docker-compose.yml" is invalid - it should be a string.

Do you want to request a feature or report a bug?

Bug

Please provide a sample input docker run command

docker run --init --rm -d -e foo=bar container:latest

What is the current output?*

version: 3
services:
    container:
        environment:
            - foo=bar
        image: 'container:latest'

What is the expected/desired output?

version: "3"
services:
    container:
        environment:
            - foo=bar
        image: 'container:latest'

The version should be a string. docker-compose tells me:

ERROR: Version in "./docker-compose.yml" is invalid - it should be a string.

support docker create input

Do you want to request a feature or report a bug?
FEATURE
Docker create is exactly the same as docker run except that it doesnt start the container.
(docker run = docker create && docker start)
Please provide a sample input docker run command

docker create -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro --restart always --log-opt max-size=1g nginx

What is the current output?*

NO OUTPUT

What is the expected/desired output?

version: 3
services:
    nginx:
        ports:
            - '80:80'
        volumes:
            - '/var/run/docker.sock:/tmp/docker.sock:ro'
        restart: always
        logging:
            options:
                max-size: 1g
        image: nginx```

Handling entry commands

Do you want to request a feature or report a bug?
bug
Please provide a sample input docker run command

docker run -p 8080:8080 -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=admin quay.io/keycloak/keycloak:18.0.2 start-dev

What is the current output?*

version: '3.3'
services:
    start-dev:
        ports:
            - '8080:8080'
        environment:
            - KEYCLOAK_ADMIN=admin
            - KEYCLOAK_ADMIN_PASSWORD=admin
        image: start-dev

What is the expected/desired output?

version: '3.3'
services:
    keycloak:
        ports:
            - '8080:8080'
        environment:
            - KEYCLOAK_ADMIN=admin
            - KEYCLOAK_ADMIN_PASSWORD=admin
        image: quay.io/keycloak/keycloak:18.0.2
        command: start-dev

Port numbers converted to booleans instead of numbers/mapping string

Do you want to request a feature or report a bug?
bug
Please provide a sample input docker run command

docker run \     --name testneo4j \     -p7474:7474 -p7687:7687 \     -d \     -v $HOME/neo4j/data:/data \     -v $HOME/neo4j/logs:/logs \     -v $HOME/neo4j/import:/var/lib/neo4j/import \     -v $HOME/neo4j/plugins:/plugins \     --env NEO4J_AUTH=neo4j/test \     neo4j:latest

What is the current output?*

version: '3.3'
services:
    neo4j:
        container_name: testneo4j
        ports:
            - true
            - true
        volumes:
            - '$HOME/neo4j/data:/data'
            - '$HOME/neo4j/logs:/logs'
            - '$HOME/neo4j/import:/var/lib/neo4j/import'
            - '$HOME/neo4j/plugins:/plugins'
        environment:
            - NEO4J_AUTH=neo4j/test
        image: 'neo4j:latest'

What is the expected/desired output?

version: '3.3'
services:
    neo4j:
        container_name: testneo4j
        ports:
            - "7474:7474"
            - "7687:7687"
        volumes:
            - '$HOME/neo4j/data:/data'
            - '$HOME/neo4j/logs:/logs'
            - '$HOME/neo4j/import:/var/lib/neo4j/import'
            - '$HOME/neo4j/plugins:/plugins'
        environment:
            - NEO4J_AUTH=neo4j/test
        image: 'neo4j:latest'

Only the last env is processed

If I have a run with several -e, only the last one is processed. example:

docker run --restart=always -h master --name prep9_db -d -p 5432:5432 -e dbname=odoo -e dbpass=aSecurePass psql
only dbpass is displayed

Parameter parsing fails if whitespace is omitted

Do you want to request a feature or report a bug?

A bug.

Please provide a sample input docker run command

npx composerize docker run -p1234:5678 postgres

What is the current output?*

version: 3
services:
    postgres:
        ports:
            - true
        image: postgres

What is the expected/desired output?

version: '3'
services:
    postgres:
        ports:
            - '1234:5678'
        image: 'postgres'

Wrong converison

  • feature request
  • bug report

Please provide a sample input docker run command

docker run -p 8000:8000 -it ctfd/ctfd

What is the current output?*

version: '3.3'
services:
    run:
        ports:
            - '8000:8000'
        image: run

What is the expected/desired output?

version: '3.3'
services:
    run:
        ports:
            - '8000:8000'
        image: ctfd/ctfd

Are you willing/able to attempt a fix?

nope

Most issues can be trivially addressed by updating this mapping:

https://github.com/magicmark/composerize/blob/dcae8ace865e2eef69e5bd27c4a9a320f56cac75/packages/composerize/src/mappings.js#L62-L66

  • Is this the case for your issue?
  • Would you be able to try? :)

Thanks for following this template and making composerize better for everyone else too!

Missing Mappings for command, cap-add, pid, privileged etc

Checked 👍
Do you want to request a feature or report a bug?
Bug. 🐛
Please provide a sample input docker run command

docker run -d --name storageos \
    -e HOSTNAME \
    -e ADVERTISE_IP=xxx.xxx.xxx.xxx \
    -e JOIN=xxxxxxxxxxxxxxxxx \
    --net=host \
    --pid=host \
    --privileged \
    --cap-add SYS_ADMIN \
    --device /dev/fuse \
    -v /var/lib/storageos:/var/lib/storageos:rshared \
    -v /run/docker/plugins:/run/docker/plugins \
    storageos/node:0.10.0 server

What is the current output?*

version: 3
services:
    server:
        container_name: storageos
        environment:
            - HOSTNAME
            - ADVERTISE_IP=xxx.xxx.xxx.xxx
            - JOIN=xxxxxxxxxxxxxxxxx
        devices:
            - /dev/fuse
        volumes:
            - '/var/lib/storageos:/var/lib/storageos:rshared'
            - '/run/docker/plugins:/run/docker/plugins'
        image: server

What is the expected/desired output?

version: '3'
services:
    node:
        container_name: storageos
        command: server
        network_mode: "host"
        pid: "host"
        privileged: true
        cap_add:
            - SYS_ADMIN
        environment:
            - HOSTNAME
            - ADVERTISE_IP=${VAR_ADVERTISE_IP}
            - JOIN=${VAR_JOIN_TOKEN}
        devices:
            - /dev/fuse
        volumes:
            - '/var/lib/storageos:/var/lib/storageos:rshared'
            - '/run/docker/plugins:/run/docker/plugins'
        image: 'storageos/node:0.10.0'

Wrong conversion when for Tailscale

Do you want to request a feature or report a bug?

  • feature request
  • [X ] bug report

Please provide a sample input docker run command

I when running the tailscale official image from https://hub.docker.com/r/tailscale/tailscale

docker run -d --name=tailscaled -v /var/lib:/var/lib -v /dev/net/tun:/dev/net/tun --network=host --privileged tailscale/tailscale tailscaled

What is the current output?*

version: '3.3'
services:
    tailscaled:
        container_name: tailscaled
        volumes:
            - '/var/lib:/var/lib'
            - '/dev/net/tun:/dev/net/tun'
        network_mode: host
        privileged: false
        image: tailscaled

What is the expected/desired output?

privileged: true
image: tailscale/tailscale

Are you willing/able to attempt a fix?

Most issues can be trivially addressed by updating this mapping:

  • Would you be able to try? :)

Sorry, I know nothing of JS and also pretty new to Docker

Use the "extra" Docker parameters

Do you want to request a feature or report a bug?
Probably a bug.

Please provide a sample input docker run command

docker run -p 9000:9000 --name minio-s3  -e "MINIO_ACCESS_KEY=my-AWS-access-key"  -e "MINIO_SECRET_KEY=my-AWS-secret-key" minio/minio gateway s3

What is the current output?*

version: '3.3'
services:
    s3:
        ports:
            - '9000:9000'
        container_name: minio-s3
        environment:
            - MINIO_ACCESS_KEY=my-AWS-access-key
            - MINIO_SECRET_KEY=my-AWS-secret-key
        image: s3

What is the expected/desired output?
I don't know, since I'm not a Docker Compose expert. But, it should somehow use minio/minio gateway, too. Most likely:

version: '3.3'
services:
    s3:
        ports:
            - '9000:9000'
        container_name: minio-s3
        environment:
            - MINIO_ACCESS_KEY=my-AWS-access-key
            - MINIO_SECRET_KEY=my-AWS-secret-key
        image: minio/minio
        command: minio gateway s3

Mounting named volumes doesn’t work in docker-compose files

I believe this is a bug.

When docker-compose tries to mount a named volume, by default it prepends the project’s name to the volume, ie, a named volume “nexus-data” will be mounted as “project_nexus-data”. The direct docker command doesn’t prepend the project name so the two commands don’t access the same data. To make docker-compose use the unmodified name, it needs to be marked as an external container and its name specified.

Please provide a sample input docker run command

docker run -d -p 8081:8081 -p 5000:5000 --name nexus --restart=always -v nexus-data:/nexus-data sonatype/nexus3

What is the current output?*

version: '3.3'
services:
    nexus3:
        ports:
            - '8081:8081'
            - '5000:5000'
        container_name: nexus
        restart: always
        volumes:
            - 'nexus-data:/nexus-data'
        image: sonatype/nexus3

What is the expected/desired output?

version: '3.3'
services:
    nexus3:
        ports:
            - '8081:8081'
            - '5000:5000'
        container_name: nexus
        restart: always
        volumes:
            - 'nexus-data:/nexus-data'
        image: sonatype/nexus3

volumes:
    nexus-data:
        external:
            name: nexus-data

-d parameter breaks image

Do you want to request a feature or report a bug?

  • feature request
  • bug report

Please provide a sample input docker run command

docker run -d ubuntu

What is the current output?*

version: '3.3'
services:
    run:
        image: run

What is the expected/desired output?

version: '3.3'
services:
    run:
        image: ubuntu

Are you willing/able to attempt a fix?

Most issues can be trivially addressed by updating this mapping:

https://github.com/magicmark/composerize/blob/dcae8ace865e2eef69e5bd27c4a9a320f56cac75/packages/composerize/src/mappings.js#L62-L66

  • Is this the case for your issue?
  • Would you be able to try? :)

Thanks for following this template and making composerize better for everyone else too!

An in-range update of rollup-plugin-commonjs is breaking the build 🚨

The devDependency rollup-plugin-commonjs was updated from 9.1.8 to 9.2.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

rollup-plugin-commonjs is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 5 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Enhancement: Add Multiple run commands

I love Compozerize!

Currently it only allows adding a single docker run line to convert; I have a bunch of HTPC containers that I have setup only using docker run commands that I really would love to be able to paste into the composerize box, separated line by line, and then have it converted into a single docker-compose.

Like this:

image

Multi-line breaks not escaped in parsing when parameters for container are present

Do you want to request a feature or report a bug?

  • feature request
  • bug report

Please provide a sample input docker run command

docker run -d \ -v vol:/tmp \ hello-world \ --parameter

What is the current output?*

version: '3.3'
services:
    \:
        volumes:
            - 'vol:/tmp'
        image: \

What is the expected/desired output?

version: '3.3'
services:
    hello-world:
        volumes:
            - 'vol:/tmp'
        image: hello-world

Are you willing/able to attempt a fix?

Most issues can be trivially addressed by updating this mapping:

https://github.com/magicmark/composerize/blob/dcae8ace865e2eef69e5bd27c4a9a320f56cac75/packages/composerize/src/mappings.js#L62-L66

  • Is this the case for your issue?
  • Would you be able to try? :)

Thanks for following this template and making composerize better for everyone else too!

Support for bind mounts

Do you want to request a feature or report a bug?

Feature

Please provide a sample input docker run command

docker run --mount type=bind,source=./logs,target=/usr/src/app/logs [IMAGE]

What is the current output?*

Not supported (no output).

What is the expected/desired output?

volumes:
  - type: bind
    source: ./logs
    target: /usr/src/app/logs

Options not translated

The following options doesn't seems to translate to the compose result:

  • --privileged
  • --cap-add
  • --cap-add
  • --device

Regards

ip, mac address, hostname, network parameters ignored

As per subject, I noticed a bunch of arguments that either are not mapped correctly (--net -> network_mode) or are completely ignored (--ip --mac-address --hostname, I'd guess --ip6 too).

Please provide a sample input docker run command

docker run -d --name test --restart=always --net=homenet --ip=192.168.1.9 --mac-address=00:00:00:00:00:09 --hostname myhost -v /import/settings:/settings -v /import/media:/media -p 8080:8080 -e UID=1000 -e GID=1000 repo/image

What is the current output?*

version: '3.3'
services:
    image:
        container_name: test
        restart: always
        network_mode: homenet
        volumes:
            - '/import/settings:/settings'
            - '/import/media:/media'
        ports:
            - '8080:8080'
        environment:
            - UID=1000
            - GID=1000
        image: repo/image

EDIT: ok this is actually a little bit more complicated than the previous example. This should be correct/expected output:

What is the expected/desired output?

version: '3.3'
services:
    image:
        container_name: test
        restart: always
        hostname: myhost
        mac_address: 00:00:00:00:00:09
        networks: 
                homenet:
                        ipv4_address: 192.168.1.9
        volumes:
            - '/import/settings:/settings'
            - '/import/media:/media'
        ports:
            - '8080:8080'
        environment:
            - UID=1000
            - GID=1000
        image: repo/image

networks:
  homenet:
    external:
      name: homenet

bad parses private docker registry images

When I use an image form a private registry, for example docker run --restart=always --privileged --name jatdb -d -p 27017:27017 -p 28017:28017 -e MONGODB_PASS="somepass" -v ~/jat/mongodata:/data/db registry.cloud.local/js/mongo

the service name is set to js instead of registry.cloud.local/js/mongo

run error

[iahmad@web-prod-ijaz001 ~]$ composerize docker run --name nginx --image nginx
/usr/lib/node_modules/composerize/dist/composerize.js:1
(function (exports, require, module, __filename, __dirname) { !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.composerize=e()}(this,function(){"use strict";function t(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function e(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function r(t){if(hn===setTimeout)return setTimeout(t,0);if((hn===e||!hn)&&setTimeout)return hn=setTimeout,setTimeout(t,0);try{return hn(t,0)}catch(e){try{return hn.call(null,t,0)}catch(e){return hn.call(this,t,0)}}}function i(t){if(pn===clearTimeout)return clearTimeout(t);if((pn===n||!pn)&&clearTimeout)return pn=clearTimeout,clearTimeout(t);try{return pn(t)}catch(e){try{return pn.call(null,t)}catch(e){return pn.call(this,t)}}}function o(){dn&&gn&&(dn=!1,gn.length?yn=gn.concat(yn):En=

TypeError: Object.entries is not a function
    at /usr/lib/node_modules/composerize/dist/composerize.js:1:74055
    at Object.<anonymous> (/usr/lib/node_modules/composerize/cli.js:6:13)
    at Module._compile (module.js:577:32)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.runMain (module.js:611:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:160:9)

Items not converted: --cpus --cpu-shares --ip

This docker run:

docker run -d --restart always -p 5432:5432 --net postgres_net --ip 172.18.0.100 --name postgres2 --cpus=3 --cpu-shares=512 --log-driver json-file --log-opt max-size=100m --log-opt max-file=10 -v /srv/postgres:/var/lib/postgresql/data postgis/postgis

converts to this:

version: '3.3'
services:
    postgis:
        restart: always
        ports:
            - '5432:5432'
        network_mode: postgres_net
        container_name: postgres2
        logging:
            driver:
                - json-file
            options: 'max-size=100m,max-file=10'
        volumes:
            - '/srv/postgres:/var/lib/postgresql/data'
        image: postgis/postgis

But is missing cpus, cpu-shares and ip.

Support "--gpus all"

Do you want to request a feature or report a bug?

  • feature request
  • bug report

Please provide a sample input docker run command

docker run -it --rm --gpus all -p 3000:3000 -v /opt/ai-art:/data overshard/ai-art

What is the current output?*

version: '3.3'
services:
    ai-art:
        ports:
            - '3000:3000'
        volumes:
            - '/opt/ai-art:/data'
        image: overshard/ai-art

What is the expected/desired output?
It should pull in GPUs somehow. I don't know exactly how. I found this but it doesn't work for me at the moment but maybe someone more docker-aware could adjust.

    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]

Are you willing/able to attempt a fix?

Most issues can be trivially addressed by updating this mapping:

https://github.com/magicmark/composerize/blob/dcae8ace865e2eef69e5bd27c4a9a320f56cac75/packages/composerize/src/mappings.js#L62-L66

  • [No] Is this the case for your issue?
  • [Not immediately] Would you be able to try? :)

Thanks for following this template and making composerize better for everyone else too!

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.