8

I'm new to Docker so bear with me for any wrong term.

I have Docker Tools installed on Windows 7 and I'm trying to run a Docker compose file of a proprietary existing project stored in a git repository and that has probably been only run on Linux.

These are the commands I ran:

  1. docker-machine start
  2. docker-machine env
  3. @FOR /f "tokens=*" %i IN ('docker-machine env') DO @%i
    • this was output by step (2)
  4. docker-compose -f <docker-file.yml> up

Most of the Docker work has gone fine (image download, extraction, etc).

It is failing at container start, where some containers run fine - I recognize a working MongoDB instance since its log doesn't report any error - but other containers exit pretty soon with an error code, i.e.:

frontend_1 exited with code 127

Scrolling up a bit the console, I can see lines like:

No such file or directoryr/bin/env: bash

I have no idea where to go from here. I tried launching composer from a CygWin terminal, but got the same result.


Docker Compose file

version: "2"

services:
  frontend:
    command: "yarn start"
    image: company/application/frontend:1
    build:
      context: frontend
      dockerfile: docker/Dockerfile
    environment:
      <env entries>
    ports:
      - "3000:3000"
    volumes:
      - ./frontend:/opt/app

  backend:
    restart: "no"
    # source ~/.bashrc is needed to add the ssh private key, used by git
    command: bash -c "source ~/.bashrc && yarn run dev"
    image: company/application/backend:1
    build:
      context: backend
      dockerfile: docker/Dockerfile
    environment:
      <env entries>
    ports:
      - "4000:4000"
    volumes:
      - ./backend:/opt/app
      - ./:/opt:rw
      - ./.ssh/company_utils:/tmp/company_utils
    depends_on:
      - db

  generator-backend:
    restart: "no"
    # source ~/.bashrc is needed to add the ssh private key, used by git
    command: bash -c "source ~/.bashrc && npm run dev"
    image: company/generator/backend:1
    build:
      context: generator-backend
      dockerfile: docker/Dockerfile
    environment:
      <env entries>
    ports:
      - "5000:5000"
    volumes:
      - ./generator-backend:/opt/app
      - ./:/opt:rw
      - ./.ssh/company_utils:/tmp/company_utils
    depends_on:
      - db

  db:
    image: mongo:3.4
    volumes:
      - mongo:/data/db
    ports:
      - "27017:27017"

volumes:
  mongo:
2
  • Can you also paste the content of the docker-file.yml file please? Commented Jul 23, 2018 at 14:55
  • @Neekoy, File attached. Commented Jul 23, 2018 at 15:09

1 Answer 1

12

It turned out it was a matter of file line endings, caused by git clone, as pointed out by @mklement0 in his answer to env: bash\r: No such file or directory question.

Disabling core.autocrlf then recloning the repo solved it.

Sign up to request clarification or add additional context in comments.

1 Comment

You just saved my day ! Was not able to find out where the problem is. Thank you very much !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.