1

I'm new to Docker and i decided to take the beginners guide on Play with docker classroom (Application Containerization and Microservice Orchestration). I tried this tutorial on my PC and installing docker for windows. In Step 1: Containerized Link Extractor Script on running the script docker container run -it --rm linkextractor:step1 http://example.com/ I'm getting an error

IT-KEVIN@IT-KEVIN MINGW64 ~/linkextractor (step1) $ docker container run -it --rm linkextractor:step1 http://example.com/ /usr/bin/env: ‘python\r’: No such file or directory

How can i fix the error?

kevin baroro
  • 29
  • 1
  • 6
  • 1
    @usr2564301 oh sorry about posting images of text. Yes, but i already switch my docker to linux containers. Still getting the error. – kevin baroro Feb 11 '20 at 09:39
  • It seems your Python cannot be located. Did you try something like this: https://askubuntu.com/questions/942930/usr-bin-env-python-no-such-file-or-directory – Jongware Feb 11 '20 at 09:42
  • @usr2564301 i already point the exact path of my python. When i try to run `python -version i get `$ python --version Python 3.7.6`. still no luck – kevin baroro Feb 11 '20 at 09:49

1 Answers1

0

\r character is is usually a sign that you have mixed different newline formats in your editor.

You need yo edit the linkextractor script and fix its newlines to Linux format.

Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435
  • Here's the script. Where would be newline? `#!/usr/bin/env python import sys import requests from bs4 import BeautifulSoup res = requests.get(sys.argv[-1]) soup = BeautifulSoup(res.text, "html.parser") for link in soup.find_all("a"): print(link.get("href")) ` – kevin baroro Feb 11 '20 at 23:56
  • Here some pointer https://stackoverflow.com/questions/1001900/which-text-editors-handle-both-windows-and-unix-style-line-breaks-properly – Mikko Ohtamaa Feb 12 '20 at 11:16