3

While locally deploying an app in PyCharm on windows10, I have encountered several mistakes. Make test command returned following mistake:

service "core" is not running container #1 
make: *** [Makefile:60: test] Error 1

And indeed container status with the command make ps returned exited(127). When I have checked docker logs for the container in question, I've seen:

/usr/bin/env: ‘bash\r’: No such file or directory

In this thread, this mistake is connected to how windows processes line endings of files from different OS. The usual solution is:

git config --global core.autocrlf false

But after running the code and updating current git repo and restarting the containers, i still get the same mistake. What might be the issue here?

Zechariah Lvov
  • 135
  • 1
  • 2
  • 10
  • 1
    The file still has DOS line endings. How are you building the image; do you need to re-run `docker build`? Or, if you're replacing the code in the image with a bind mount, does the file on the host system have the right line endings? – David Maze Dec 16 '21 at 14:07
  • Check `dos2unix`. – Nic3500 Dec 17 '21 at 03:14
  • Hey, David, I use make and makefile to build the images inside the docker compose. How i can change the DOS endings? The project was downloaded from gitlab and written on macOS or Linux. Inside docker-compose it should run on ubuntu slice. When is the moment the DOS endings are created? – Zechariah Lvov Dec 19 '21 at 13:36
  • and how i can figure out which files are affected? – Zechariah Lvov Dec 19 '21 at 13:46
  • I have edited the project code style to run as it's suggested in the link to have Unix and MacOS line separator, but it still returns the same mistake - Error 1 https://www.jetbrains.com/help/pycharm/configuring-line-endings-and-line-separators.html – Zechariah Lvov Dec 19 '21 at 14:45

2 Answers2

6

When I use Windows in Docker and run a bash script, I have a similar problem, which I solve by using LF instead of CRLDF as the line separator.

in vscode, we can change it here enter image description here

Fauzan Taufik
  • 189
  • 3
  • 5
3

What did helped me I assume that the problem was in the windows line endings in the Unix-based containers. To solve it I found two very helpful instructions:

  1. Configure your line separators in the PyCharm https://www.jetbrains.com/help/pycharm/configuring-line-endings-and-line-separators.html
  2. To clarify that changes were really enabled, I have checked the files in the notepad++ https://notepad-plus-plus.org/downloads/v8.1.9.3/
  3. Also it was helpful to check the original code because part of the problem was the incorrect spelling of some commands.
Zechariah Lvov
  • 135
  • 1
  • 2
  • 10