Git, Docker and CR/LF world of pain.

Docker

As part of a project myself and a colleague were about to commence work on he’d created a docker image of a lightweight Linux image serving SFTP endpoints to replicate the Dev eco system. It was working like a dream. We were setting up and tearing down the containers happily until we checked out the docker files on my machine and that’s where the fun started…..

Git Checkout Pain

So, I checkout my colleagues cool Docker work and hit the docker-compose up –build. It runs through quite happily then craps out right at the end beefing about the following:


standard_init_linux.go:175: exec user process caused "no such file or directory"

Mixed Messages online

Eh? Ok so I’m guessing there’s a host folder location that isn’t right here? After a fair bit of Docker folder and file checking I rerun Docker build and the same issue. I admit defeat and head for Google. Google brings back a rather mixed bag of results from StackOverflow and elsewhere. But the narrative is starting to make sense. Essentially Git checkout is introducing Windows carriage returns to our Dockerfile which in turn is freaking our Docker build. I remember that when you install Git there’s a number of options around handling carriage returns etc. So……





Git re-install? Nope!

I reinstall Git and notice the following…



Ok so it looks like I need the middle option right? Git installs and I go for broke again clearing down the source code and starting with a fresh git clone. I run docker and still no dice!! Wah!!!

One last shot

I throw open Git bash and issue the following:


git config --global core.autocrlf input


Success! I run Docker in and we’re away.

Leave a Reply