KENT SU
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    --- title: Docker-registry tags: Docker slideOptions: ##theme: solarized transition: 'slide' spotlight: enabled: false --- # Docker-registry --- ## Docker-registry Docker Registry 是一個用於存儲和分發 Docker 映像檔的服務器。它可以讓用戶自己託管映像檔,也可以從公共映像檔庫中拉取映像檔。在此提供一個基於 Docker Compose 的 Docker Registry 教學。 --- ## Docker login - `docker login` 是 Docker CLI 提供的指令,可以讓你登入到 Docker registry 並建立認證憑證,以便你可以在該 registry 上 push 或 pull Docker image。 ---- 1. 在你的終端機上,執行以下指令: ```bash= docker login <registry> ``` 其中 `<registry>` 是指你要登入的 Docker registry 的位置。例如,如果你要登入 Docker Hub,則 `<registry>` 不用填, 在課程中,我們用私有倉庫:`https://docker-registry.3anology.info`。 ---- 1. 當你執行完上面的指令後,你會被提示輸入你的使用者名稱和密碼。輸入正確的認證資訊後,你就成功登入了該 Docker registry。 2. 如果你要登出已經登入的 registry,可以執行以下指令: ```bash= docker logout <registry> ``` ---- 注意事項: - 如果你使用的是私有的 Docker registry,請記得在 `docker login` 指令中加上 registry 的位置。 - 如果你使用的是 Docker Hub,請注意每個帳號每天只有 100 次的 pull 限制,但是 push 沒有限制。如果需要更多的 pull 次數,可以升級到付費帳戶。 --- ## Portainer 使用 Docker-registry ---- ### 1. 註冊Docker-registry ![](https://i.imgur.com/HdMN4El.png) ---- ![](https://i.imgur.com/XZSxAmF.png) ---- ![](https://i.imgur.com/eSHRIZ6.png) ---- ### 2. 位置與帳密 ### 3. 試著pull image ![](https://i.imgur.com/3OOnvr7.png) image : node-red-test --- ## 建立 Docker-registry ---- ### 1. Docker compose ```yaml= version: '3' services: registry: # 容器名稱為 registry image: registry:2 # 使用 registry:2 的映像檔 ports: - "15000:5000" # 將容器內部的 5000 Port 對應到主機的 15000 Port volumes: - /volume1/docker/docker-registry/data:/var/lib/registry # 掛載主機上的 /volume1/docker/docker-registry/data 目錄到容器內的 /var/lib/registry 目錄 - /volume1/docker/docker-registry/config:/auth # 掛載主機上的 /volume1/docker/docker-registry/config 目錄到容器內的 /auth 目錄 environment: REGISTRY_AUTH: htpasswd # 啟用 htpasswd 的驗證方式 REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd # 指定驗證檔案為容器內的 /auth/htpasswd REGISTRY_AUTH_HTPASSWD_REALM: Registry Realm # 設定驗證領域為 Registry Realm htpasswd: # 容器名稱為 htpasswd image: xmartlabs/htpasswd # 使用 xmartlabs/htpasswd 的映像檔 command: -Bbn 3anology hNhHrGxzbXL4 # 執行 htpasswd 指令,建立名稱為 3anology 密碼為 hNhHrGxzbXL4 的使用者帳號 volumes: - /volume1/docker/docker-registry/auth:/config # 掛載主機上的 /volume1/docker/docker-registry/auth 目錄到容器內的 /config 目錄 environment: HTPASSWD_FILE: /config/htpasswd # 指定 htpasswd 檔案為容器內的 /config/htpasswd HTPASSWD_USERNAME: 3anology # 設定帳號名稱為 3anology HTPASSWD_PASSWORD: hNhHrGxzbXL4 # 設定帳號密碼為 hNhHrGxzbXL4 ``` ---- ### 2. 使用線上版htpasswd [產生器](https://zh-tw.rakko.tools/tools/20/) ![](https://i.imgur.com/GTOlEqQ.png)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully