c00cjz00
    • 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
    • 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 Versions and GitHub Sync Note Insights 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
    7
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Docker安裝教學 ## :memo: Where do I start? - 聯絡窗口 Email us : 2303117@narlabs.org.tw 王小姐 ## 安裝 Docker ### Linux 1. 更新及安裝相關套件 ``` sudo apt-get -y update sudo apt-get -y upgrade sudo apt-get -y install ca-certificates curl gnupg lsb-release joe rsync zip unzip tmux ``` 2. 安裝 Docker > 安裝程式, 請先 `sudo ls` 一次, 在執行下方指令, 並免再次問密碼 ``` curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg ``` ``` echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null ``` ``` sudo apt-get update -y sudo apt-get -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin ``` 3. ubuntu 加入 Docker 群組 ``` sudo usermod -aG docker $USER sudo systemctl enable docker # 啟動 Docker 服務 docker --version ``` 4. 切換兩次身分, 或重新登入測試安裝結果 ``` sudo su su ubuntu docker run hello-world ``` 5. 下載ANYTHINGLLM及Ollama - 下載anythingllm ``` docker pull mintplexlabs/anythingllm ``` - 下載ollama ``` docker pull ollama/ollama ``` - 確認已經下載Image ``` docker images ``` - 影片教學 {%youtube ZnT3fj72XXA %} ### Windows 0. 確認是否有內建WSL - 打開powershell ``` wsl -l ``` - 安裝wsl ``` wsl --install ``` 2. 原廠說明網站 https://docs.docker.com/desktop/install/windows-install/ 3. 下載 Docker 建議由上面 (1) 原廠說明連結下載 [[Download]](https://desktop.docker.com/win/main/amd64/139021/Docker%20Desktop%20Installer.exe?_gl=1*fsgutp*_ga*MTU5NTI2NjcyLjE2NjUxMzI3NTY.*_ga_XJWPQMJYHQ*MTcxMDY0MzIzNy40NDkuMS4xNzEwNjQzNjE5LjU4LjAuMA..) 4. 安裝 Docker選項 ![image](https://hackmd.io/_uploads/BJLFtA7Ra.png) 5. 安裝 Docker過程 ![image](https://hackmd.io/_uploads/BJM4c0QAa.png) 6. 完工 ![image](https://hackmd.io/_uploads/H1rnjC70p.png) 7. 開啟 DOCKER Desktop, 並搜尋映像檔下載 - 搜尋ANYTHINGLLM, 選擇第一個並按下PULL 下載 ![image](https://hackmd.io/_uploads/rJFhhA7Ap.png) - 搜尋Ollama, 選擇第一個並按下PULL 下載 ![image](https://hackmd.io/_uploads/H1-c3AXRT.png) - 點選Docker Desktop, 左側Image 按鈕, 檢視下載狀況 ![image](https://hackmd.io/_uploads/BkbEa0QAp.png) - 影片教學 (外部網站教學, 略與本次教學稍微不同) {%youtube LgHEl070z0k %} ### Mac osX 1. 原廠說明網站 https://docs.docker.com/desktop/install/mac-install/ 2. 下載 Docker 建議由上面 (1) 原廠說明連結下載 [[Download]](https://desktop.docker.com/mac/main/amd64/Docker.dmg?utm_source=docker&utm_medium=webreferral&utm_campaign=docs-driven-download-mac-amd64&_gl=1*195o2ib*_ga*MTU5NTI2NjcyLjE2NjUxMzI3NTY.*_ga_XJWPQMJYHQ*MTcxMDY0MzIzNy40NDkuMS4xNzEwNjQ0NjQzLjYwLjAuMA..) 3. 安裝 Docker選項 - 將下載好的 Docker.dmg 點下去安裝, 安裝完後將 Docker.app 拖到 Applications, 應用程式裡就有圖像介面軟體可以使用 ![image](https://hackmd.io/_uploads/B1dI0RX0p.png) 4. Docker Desktop 不使用的時候需要在狀態列右上角 Quit ![image](https://hackmd.io/_uploads/ry5qA0mAa.png) 5. 打開終端機 (Terminal) 輸入以下指令  - 下載anythingllm ``` docker pull mintplexlabs/anythingllm ``` - 下載ollama ``` docker pull ollama/ollama ``` - 確認已經下載Image ``` docker images ls ``` - 影片教學 {%youtube Q2eeLVEVaaM %} ## 安裝 NVIDIA DRIVER FOR LINUX ``` sudo apt-get -y update sudo apt-get -y upgrade sudo apt-get install build-essential -y sudo apt-get install ubuntu-drivers-common -y sudo apt-get -y upgrade sudo ubuntu-drivers list --gpgpu sudo ubuntu-drivers install nvidia:535-server # 重開機 # reboot ``` ## 安裝 NVIDIA Container Toolkit nvidia-container-toolkit 是一個更新的工具,適用於支援NVIDIA GPU 的容器管理系統(如Docker 和Kubernetes)。它提供了一個簡單的方法來將NVIDIA GPU 暴露給容器,並且可以輕鬆管理GPU 裝置上下文和NVIDIA 驅動。 ### Install with Apt 1. Configure the repository ``` curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey \ | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list \ | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' \ | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list sudo apt-get update ``` 2. Install the NVIDIA Container Toolkit packages ``` sudo apt-get install -y nvidia-container-toolkit ``` ### Configure Docker to use Nvidia driver (請參考最上方教學, 先安裝 DOCKER) ``` sudo nvidia-ctk runtime configure --runtime=docker sudo systemctl restart docker ``` ### REMOVE NVIDIA Container Toolkit Ubuntu and Debian ``` #To remove CUDA Toolkit: sudo apt-get --purge remove "*cuda*" "*cublas*" "*cufft*" "*cufile*" "*curand*" \ "*cusolver*" "*cusparse*" "*gds-tools*" "*npp*" "*nvjpeg*" "nsight*" "*nvvm*" #To remove NVIDIA Drivers: sudo apt-get --purge remove "*nvidia*" "libxnvctrl*" #To clean up the uninstall: sudo apt-get autoremove ``` ## Ollam 範例GPU測試 ### NVIDIA GPU eample: Start the container ``` docker run -d --gpus=all -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama ``` ### AMD GPU eample: Start the container To run Ollama using Docker with AMD GPUs, use the rocm tag and the following command: ``` docker run -d --device /dev/kfd --device /dev/dri -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama:rocm ``` ### Run model locally - Now you can run a model: ``` #docker exec -it ollama ollama run llama2 docker exec -it ollama ollama pull gemma docker exec -it ollama ollamap pull ycchen/breeze-7b-instruct-v1_0 docker exec -it ollama ollama pull nomic-embed-text docker exec -it ollama ollama list #docker exec -it ollama ollama rm llama2 ``` - api ("stream": false or "stream": true ) ``` curl http://localhost:11434/api/generate -d '{ "model": "ycchen/breeze-7b-instruct-v1_0", "prompt": "請列出五樣台灣美食", "stream": true, "options": { "seed": 123, "top_k": 20, "top_p": 0.9, "temperature": 0 } }' ``` ![image](https://hackmd.io/_uploads/rJW39bE0p.png) ## DOCKER CONTAINER間網路關聯設定 - 在container内,可以直接请求host.docker.internal:PORT, ``` # docker run --add-host=host.docker.internal:host-gateway # docker-compose extra_hosts: "host.docker.internal:host-gateway" # VECTOR_DB="chroma" CHROMA_ENDPOINT='http://host.docker.internal:8000' ```

    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