0

Pushing to local docker registry gives connection reset error

It was this same situation but instead for github actions which appeared to have different issues.

I also followed this: https://github.com/docker/for-mac/issues/3611

All of them resulted in the same error where we could not put a docker image to the local host. Error in question:

The push refers to repository [registry.me:6000/image_name]
Get http://registry.me:6000/v2/: read tcp 127.0.0.1:34086->127.0.0.1:6000: read: connection reset by peer
dtracers
  • 101
  • 2

1 Answers1

0

https://serverfault.com/a/835934/574685 <- this ended up being a part of the solution but additionally I did need to add the fake localhost to the image as listed in: https://github.com/docker/for-mac/issues/3611

My final setup for github actions:

env:
  IMAGE_TAG:    registry.me:5000/imagename

jobs:
  build:
    runs-on: ubuntu-latest
    timeout-minutes: 20
    # Install things
    steps:
      - name: modify hosts file
        run:  sudo echo "127.0.0.1        localhost registry.me" | sudo tee -a /etc/hosts

      - name: Build image
        run:  docker build -t $IMAGE_TAG .

      - name: run docker compose
        working-directory: ./.github/ymls
        run:  |
        mkdir data
        ls -l
        docker-compose up &

      - name: push image to local registry
        run:  docker push $IMAGE_TAG

And then in the .githubs/yml folder (you can put your docker compile anywhere is my understanding)

registry:
  image: registry:2
  ports:
    - 127.0.0.1:5000:5000
  environment:
    REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /data
  volumes:
    - ./data:/data

This allowed me to push my own built docker image to a local registry.

dtracers
  • 101
  • 2