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

Custom registry support #61

Closed
sardaukar opened this issue May 7, 2024 · 15 comments
Closed

Custom registry support #61

sardaukar opened this issue May 7, 2024 · 15 comments
Assignees
Labels
enhancement New feature or request released

Comments

@sardaukar
Copy link

I logged in to my private registry on the local Docker daemon and tried creating an app with an image from that registry, but it says it's missing basic auth.

@YuukanOO YuukanOO added the enhancement New feature or request label May 7, 2024
@YuukanOO YuukanOO added this to the Roadmap milestone May 7, 2024
@YuukanOO
Copy link
Owner

YuukanOO commented May 7, 2024

This will be my next priority after #17

Thanks for reporting it ;)

@YuukanOO
Copy link
Owner

YuukanOO commented May 7, 2024

Some initial thoughts. We should provide a new section in the target configuration to configure custom registries with:

  • address
  • username
  • password

When configuring a target, we can use those credentials to populate the docker CredentialsStore:

cli, _ := command.NewDockerCli()

cli.Initialize(flags.NewClientOptions())

store := cli.ConfigFile().GetCredentialsStore("https://index.docker.io/v1/") // Look like the domain here is only used to get an appropriate helper

err = store.Store(types.AuthConfig{
    Username:      "<username>",
    Password:      "<personal access token>",
    ServerAddress: "https://index.docker.io/v1/", // Here for the docker hub private registries
})

@YuukanOO YuukanOO self-assigned this May 7, 2024
@YuukanOO YuukanOO modified the milestones: Roadmap, Next May 19, 2024
@YuukanOO
Copy link
Owner

I logged in to my private registry on the local Docker daemon and tried creating an app with an image from that registry, but it says it's missing basic auth.

When you're talking about your private registry, are you talking about Docker Hub private ones or self-hosted with the registry image?

@sardaukar
Copy link
Author

I mean my personal self-hosted one, yes

@YuukanOO
Copy link
Owner

I'd never use custom self-hosted docker registries. Could you provide the command you use to start the registry and how you log into it so I can reproduce it exactly?

@sardaukar
Copy link
Author

sardaukar commented May 21, 2024

This is my setup for it on dockge, should be similar on normal compose:

services:
  registry:
    image: registry:2.8.3
    restart: always
    volumes:
      - /volume1/docker/compose/data/registry/config.yml:/etc/docker/registry/config.yml
      - /volume1/docker/compose/data/registry/data:/data
      - /volume1/docker/compose/data/registry/auth:/auth
  
  ui:
    image: joxit/docker-registry-ui:main
    restart: always
    environment:
      - SINGLE_REGISTRY=true
      - REGISTRY_TITLE=Docker Registry UI
      - DELETE_IMAGES=true
      - SHOW_CONTENT_DIGEST=true
      - NGINX_PROXY_PASS_URL=http://registry:5000
      - SHOW_CATALOG_NB_TAGS=true
      - CATALOG_MIN_BRANCHES=1
      - CATALOG_MAX_BRANCHES=1
      - TAGLIST_PAGE_SIZE=100
      - REGISTRY_SECURED=true
      - CATALOG_ELEMENTS_LIMIT=1000
    labels:
      traefik.enable: "true"
      traefik.http.routers.registry-ui.rule: Host(`registry.my.domain`)
      traefik.http.routers.registry-ui.service: registry-ui
      traefik.http.routers.registry-ui.entrypoints: https
      traefik.http.routers.registry-ui.tls.certresolver: gandi
      traefik.http.routers.registry-ui.tls.domains[0].main: my.domain
      traefik.http.routers.registry-ui.tls.domains[0].sans: "*.my.domain"
      traefik.http.services.registry-ui.loadbalancer.server.port: "80"

I run the registry image and a UI for it. The auth mount for the registry has a simple htpasswd file, created with apache-utils.

This is the config.yml for the registry:

version: 0.1

log:
  fields:
    service: registry

storage:
  cache:
    blobdescriptor: inmemory
  filesystem:
    rootdirectory: /data
  delete:
    enabled: true

http:
  addr: :5000
  headers:
    X-Content-Type-Options: [nosniff]
    Access-Control-Allow-Origin: ['*']
    Access-Control-Allow-Methods: ['*']
    Access-Control-Allow-Credentials: [true]
    Access-Control-Allow-Headers: [Authorization, Accept, Cache-Control]
    Access-Control-Expose-Headers: [Docker-Content-Digest]
  secret: super_secret_string
  host: https://registry.my.domain

health:
  storagedriver:
    enabled: true
    interval: 10s
    threshold: 3

auth:
  htpasswd:
    realm: "Registry Realm"
    path: /auth/htpasswd

Let me know if you need more info

@YuukanOO YuukanOO changed the title Private registry support? Private registry support May 22, 2024
@YuukanOO YuukanOO changed the title Private registry support Custom registry support May 23, 2024
@YuukanOO
Copy link
Owner

I got something working but would like your opinion. At first, I've decided to add a custom registries option to the Docker provider (so they are configured per target) but I'm wondering if it should be a resource on its own, like Apps & Targets :/ What do you think?

And thanks for providing your configuration, I got it working locally to test my implementation :)

@sardaukar
Copy link
Author

sardaukar commented May 23, 2024

The custom registries aren't a property of the running Docker daemon, so to me it makes sense to have them separately.

OR just use the ones that the running Docker has logins for (in ~/.docker/config.json) and then the user logs in to those registries outside of seelf and you don't have a UI for it.

I do prefer the first option 😃

@YuukanOO
Copy link
Owner

So from your perspective registries should be shared across targets right?

And yes, the goal is to have an UI so you don't have to mess with the CLI :)

@sardaukar
Copy link
Author

I think they should be shared, yes. I can run the same custom registry image on multiple Docker daemons, and configuring it just once would make the most sense.

@YuukanOO
Copy link
Owner

I'm almost done, will work on the appropriate documentation this afternoon.

github-actions bot pushed a commit that referenced this issue May 27, 2024
# [2.3.0](v2.2.2...v2.3.0) (2024-05-27)

### Bug Fixes

* select option on windows not showing correctly ([77665af](77665af))

### Features

* add custom registries support, closes [#61](#61) ([73a3bfa](73a3bfa))
@YuukanOO
Copy link
Owner

🎉 This issue has been resolved in version 2.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sardaukar
Copy link
Author

sardaukar commented May 27, 2024 via email

@YuukanOO
Copy link
Owner

YuukanOO commented May 27, 2024

Fingers crossed! I hope everything will be good :)

@YuukanOO YuukanOO removed this from the Next milestone May 27, 2024
@sardaukar
Copy link
Author

Ok, just tried it and works flawlessly! Thanks - I did find an issue but will open it separately

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

No branches or pull requests

2 participants