CorentinTh / it-tools

Collection of handy online tools for developers, with great UX.
https://it-tools.tech
GNU General Public License v3.0
21.15k stars 2.54k forks source link

[BUG] Docker run to compose converter has trouble with environment variables #838

Open Steltek opened 8 months ago

Steltek commented 8 months ago

Which tool is impacted? Docker run to Docker compose converter

To Reproduce Steps to reproduce the behavior:

  1. Open the converter.
  2. Paste this example:
docker run --detach \
  --env DOWNLOADER="your name" \
  --env SELECTED_PROJECT="auto" \
  --name archiveteam-warrior \
  --label=com.centurylinklabs.watchtower.enable=true \
  --restart=on-failure \
  --publish 8002:8001 \
  atdr.meo.ws/archiveteam/warrior-dockerfile

from https://github.com/ArchiveTeam/warrior-dockerfile

The resulting output is this:

version: '3.9'
services:
    your:
        command: 'name" \'
        image: your
        environment:
            - DOWNLOADER=

(The "your name" from the --env environment variable somehow got injected into the service tag, command, and image, and the rest of the original docker command is missing entirely.)

Expected behavior

Compose output should be like this:

version: '3.9'
services:
    archiveteam:
        image: atdr.meo.ws/archiveteam/warrior-dockerfile
        ports:
            - '8002:8001'
        environment:
            DOWNLOADER: "your name"
            SELECTED_PROJECT: "auto"
        restart: on-failure
        labels:
            - com.centurylinklabs.watchtower.enable=true
        container_name: archiveteam-warrior

Configuration (please complete the following information):

Additional info:

Removing the double quotes from the command line seems to make it recognise the env parameters correctly.

sharevb commented 7 months ago

HI @Steltek and @CorentinTh , fixed in #845