简体   繁体   中英

Dockerfile script working in native Ubuntu but not in Windows or WSL

In my Dockerfile I have the next RUN script:

RUN set -ex; \
  echo "Downloading plugins"; \
  cd /tmp/plugins; \
  for f in `cat plugins.list`; do\
    curl -O -fSL $f; \
  done;

When I build the image from native Ubuntu it works flawlessly, but when I do it from Powershell or Ubuntu in Windows Subsystem for Linux it always gives me the same error:

 ---> Running in 095faf998ee4
 + echo 'Downloading plugins'
 + cd /tmp/plugins
 Downloading plugins                                                                                             
 + cat plugins.list
 ' curl -O -fS 'https://downloads.wordpress.org/plugin/ninja-forms.3.4.19.zip
 curl: (3) URL using bad/illegal format or missing URL    

If I run the curl command directly from bash it works flawlessly too, but if I run that part of the script it fails too.

As @cbley commented, the issue was in the EOL character, since on default sublime text on windows has EOL like windows, it was giving errors to the script.

Either replacing with tr -d '\r' < plugins.list > plugins.list_new as @cbley commented on my question or setting sublime text's default EOL as "Unix" by adding "default_line_ending": "unix", to the sublime preferences did the trick.

Thanks @cbley!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM