Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create a presonal registry and allow to push by github actions. #44

Closed
jeffrey-lunaon opened this issue May 14, 2020 · 14 comments
Closed

Comments

@jeffrey-lunaon
Copy link

I created a docer registry but have no https certificate, and I don't known how to push automatic by github actions.

I can push image locally if I configer in /etc/docker/daemon.json

{
    "insecure-registries": [
        "xxxx:5000"
    ]
}

But I don't know how to push it when I use the Github Actions, I tried to edit the /etc/docker/daemon.json at the workflows, but It told me Permission denied.

image

Push image directly:
image

@jeffrey-lunaon
Copy link
Author

Update:
I tried to create a free https certificate by acmesh.sh and access it successed on the chrome, but when I push the image, it told me http: server gave HTTP response to HTTPS client

@jeffrey-lunaon jeffrey-lunaon changed the title How to push insecure self hosted registry How to push create a presonal registry and allow to push by github actions. May 15, 2020
@jeffrey-lunaon jeffrey-lunaon changed the title How to push create a presonal registry and allow to push by github actions. How to create a presonal registry and allow to push by github actions. May 15, 2020
@jeffrey-lunaon
Copy link
Author

I'm already solved this problem, I can't use nginx proxy_pass the https to registry, it's not stable and I got some error.

@robbyawaldi
Copy link

i have same problem, how to solve it?

@andylamax
Copy link

how is this solved?

@michelkok
Copy link

To anyone coming back to this much later like I did.
It can be solved using #551.
Specifically make sure to configure Docker Buildx like so:

name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1
        with:
          config-inline: |
            [registry."custom-repo.net"]
              http = true
              insecure = true

@tonydawhale
Copy link

tonydawhale commented Nov 2, 2023

@michelkok

To anyone coming back to this much later like I did. It can be solved using #551. Specifically make sure to configure Docker Buildx like so:

name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1
        with:
          config-inline: |
            [registry."custom-repo.net"]
              http = true
              insecure = true

I tried using this strategy, but I had a problem once I reached the login step. Below is my workflow... Any thoughts?
image

  docker:
    name: deploy image to docker registry
    runs-on: ubuntu-latest
    if: |
      github.event_name != 'pull_request'
    needs: [yarn, eslint, prettier, typescript]
    steps:
      - uses: actions/checkout@v3

      - name: Set up QEMU
        uses: docker/setup-qemu-action@v3

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3
        with:
          config-inline: |
            [registry."${{ secrets.DOCKER_REGISTRY_DOMAIN }}"]
              http = true
              insecure = true

      - name: Login to Docker
        uses: docker/login-action@v3
        with:
          registry: ${{ secrets.DOCKER_REGISTRY_DOMAIN }}
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}

      - name: Build and push to Docker Registry
        uses: docker/build-push-action@v5
        with:
          context: .
          push: true
          tags: ${{ secrets.DOCKER_REGISTRY_DOMAIN }}/sbm-v3:latest

@michelkok
Copy link

I'm using it in a similar way except my registry does not require a login (and I use v2 of the repo's, but I doubt that's really anything). Are you sure your credentials are right?

@tonydawhale
Copy link

tonydawhale commented Nov 2, 2023

Yes, when I log in via the CLI with the registry URL in the insecure-registries section of the docker engine settings tab in Docker Desktop, I can log in with my creds with no problem. Without putting the registry URL in that config, I encounter the same exact error when trying to log in. It seems as if the config isn't being passed along or something.

❯ docker login my-domain
Username: my-user
Password:
Error response from daemon: Get "https://my-domain/v2/": http: server gave HTTP response to HTTPS client

Also, if your registry does not require a login, then how do you keep it secure?

@michelkok
Copy link

Okay, sorry, then I don't know but I doubt it's the config as for me (and I suppose for someone else liking my post) that usually the config should be passed.
I keep it relatively safe by keeping it in an internal network, but definitely will add credentials at some point. There has not really been a need up to now.

@PhoenixNazarov
Copy link

I was unable to do this using the suggested solution docker/setup-buildx-action@v3. I did this using the usual docker commands. Perhaps truncate is too much here.

    - name: Insecure Docker Repository
      run: |
        sudo truncate -s-2 /etc/docker/daemon.json
        echo ", \"insecure-registries\": [\"${{ vars.DOCKER_HOST }}\"]}" | sudo tee -a /etc/docker/daemon.json
        sudo systemctl restart docker
    - name: Docker Auth
      run: docker login ${{ vars.DOCKER_HOST }} --username=${{ vars.DOCKER_USERNAME }} --password=${{ secrets.DOCKER_PASSWORD }}

telegram-cloud-photo-size-2-5353046375455117069-y

@onursedef
Copy link

I was unable to do this using the suggested solution docker/setup-buildx-action@v3. I did this using the usual docker commands. Perhaps truncate is too much here.

    - name: Insecure Docker Repository
      run: |
        sudo truncate -s-2 /etc/docker/daemon.json
        echo ", \"insecure-registries\": [\"${{ vars.DOCKER_HOST }}\"]}" | sudo tee -a /etc/docker/daemon.json
        sudo systemctl restart docker
    - name: Docker Auth
      run: docker login ${{ vars.DOCKER_HOST }} --username=${{ vars.DOCKER_USERNAME }} --password=${{ secrets.DOCKER_PASSWORD }}

telegram-cloud-photo-size-2-5353046375455117069-y

This was a perfect solution for me. Thanks for the work!

@tonydawhale
Copy link

I was unable to do this using the suggested solution docker/setup-buildx-action@v3. I did this using the usual docker commands. Perhaps truncate is too much here.

    - name: Insecure Docker Repository
      run: |
        sudo truncate -s-2 /etc/docker/daemon.json
        echo ", \"insecure-registries\": [\"${{ vars.DOCKER_HOST }}\"]}" | sudo tee -a /etc/docker/daemon.json
        sudo systemctl restart docker
    - name: Docker Auth
      run: docker login ${{ vars.DOCKER_HOST }} --username=${{ vars.DOCKER_USERNAME }} --password=${{ secrets.DOCKER_PASSWORD }}

telegram-cloud-photo-size-2-5353046375455117069-y

@PhoenixNazarov Were you still able to push to that registry? I am encountering a new, yet similar issue in my build-push action:

Error: buildx failed with: ERROR: failed to solve: failed to push ***/***-v3:latest: failed to do request: Head "https://***/v2/***-v3/blobs/sha256:2ac50195915c3fbb68a8083db890ef3a0bc6c4f2b9917961f7bcb24fa41ee707": http: server gave HTTP response to HTTPS client

@andream7
Copy link

  • name: Docker Auth
    run: docker login ${{ vars.DOCKER_HOST }} --username=${{ vars.DOCKER_USERNAME }} --password=${{ secrets.DOCKER_PASSWORD }}

I've encountered the same issue as well.

@stevenlafl
Copy link

stevenlafl commented Mar 11, 2024

To anyone coming back to this much later like I did. It can be solved using #551. Specifically make sure to configure Docker Buildx like so:

name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1
        with:
          config-inline: |
            [registry."custom-repo.net"]
              http = true
              insecure = true

Thanks. This works. It tripped me up at first, because of the [registry.. If your registry is accessible at registry.domain.com, and you push to registry.domain.com, you still need [registry."registry.domain.com"] - it looks weird, but it isn't like other docker configuration where you -would- do it this way: ["registry.domain.com"], like your local docker engine config.

Essentially, to make it clear, comparing the above to this:

name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
  config-inline: |
    [registry."registry.domain.com"]
      http = true
      insecure = true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants