Docker Compose not working: "RST_STREAM with error code: INTERNAL_ERROR"

I am getting the following issue when running docker-compose up in on my machine

[+] Building 0.1s (2/2) FINISHED
 => [internal] load .dockerignore                                                                               0.1s 
 => => transferring context: 2B                                                                                 0.0s 
 => [internal] load build definition from Dockerfile                                                            0.1s 
 => => transferring dockerfile: 119B                                                                            0.0s 
failed to solve: Internal: Internal: stream terminated by RST_STREAM with error code: INTERNAL_ERROR

For some context, I am just trying to get a basic golang image up as per this tutorial

My docker-compose.yml file looks like this

version: '3.8'

    build: .
      - "3000:3000"
      - .:/usr/src/app

My Dockerfile looks like this

FROM golang:1.19

WORKDIR /usr/src/app

File structure

|- Dockerfile
|- docker-compose.yml

Other details about my system:

  • Windows 10
  • Docker version 4.19.0
  • Compose: v2.17.3
  • Engine: 23.0.5

What I have referred to:

  • Docker build not working: rpc error (PROTOCOL_ERROR)
  • I have also referred to another stack overflow thread “docker-compose, failed to solve: rpc error: code = Unknown desc = failed to compute cache key: “/app/package.json” not found: not found” (sorry I could only put 2 links)
  • I have another repository with a docker-compose.yml that starts up a django and postgres container and works fine. Can’t share more about that because it’s work related.

What I have done:

  • toggling buildkit on and off
  • turning off other network services like Synctazor on my machine
  • uninstall and reinstall docker, restart, update docker desktop

It seems you tried hard. I didn’t remember it, but there was another related issue before:

The last user who commented could solve it by updating Docker which you tried too, but which version did you update from?

I didn’t take note of what the previous version was, but it must be quite some time since I last update…,

However, I found a very strange workaround for the issue:

The error seems to come about when I run docker-compose from a newly clone github repository (my own repo)

However, when I made a new directory locally instead and ran docker-compose from there, it worked and I was able to get containers built, use docker bash etc.

Have you encountered similar issues before?

No, but I rarely use Docker on Windows. So the error happens only when you build a specific image or could you build the same content by creating everything locally instead of cloning from the repo?

I was able to build the same content by creating everything locally

Then my guess is that your Git client on Windows changes line endings when you clone the project. Git Bash let’s you turn this behaviour off when you install it. I don’t know why line endings would cause the error you had, but chaning line endings automatically can definitely cause problems.

Thank you for bringing this up! Never knew of such a thing and I will have to look into this further

@rimelek clone from git bush really worked for me, thanks a lot! Will be greate to add that info into guide page for windows section Containerize an application | Docker Documentation

I had a similar problem. For me changing the file encoding, to UTF-8 solved the issue. In VS Code there is the metadata in the bottom right corner. There you can go on the encoding method and change it to UTF-8 (do “Save with Encoding” and not the other one). I hope it helps someone, as it took years of my life.