0

Normally in a docker compose file you have

volumes:
      - ./:/app

And you mount all files into the container. I need to mount all except one particular file that I want to only Copy over in the Dockerfile. I have to convert the line endings from windows to linux but if I mount my local directory over then it overwrites this and causes issues.

Error


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

Which I am using dos2unix to convert in the Dockerfile.

mjwrazor
  • 1,866
  • 2
  • 26
  • 42
  • 1
    You can't exclude files from mounted directories, you can only mount them entirely. Is there a reason you can't just change the file's line endings to always be LF? If that's a git repository, you may need [this](https://stackoverflow.com/questions/2517190/how-do-i-force-git-to-use-lf-instead-of-crlf-under-windows). Or you could make a `dist/` directory which you'd "compile" your files to before building your image. – Leonardo Dagnino Dec 08 '20 at 23:29
  • This was purely for development, which is why I was mounting to my dev environment. I might look into trying to download the specific file from a git repo so its not something in my current project instead of having the file locally in my repo. Thank you for the advice. – mjwrazor Dec 09 '20 at 22:18

0 Answers0