![](https://hackmd.io/_uploads/BkOhRNX0n.png) --- ## WTF is Docker ??? ![](https://hackmd.io/_uploads/r1BHkHmC2.png) ---- Docker --- ## 為什麼要用Docker ---- 比起一般的虛擬化,使用 Docker 有許多優勢 ---- ## 一般的VM v.s. Docker ![](https://hackmd.io/_uploads/SkDPGBmA3.png =700x)![](https://hackmd.io/_uploads/r1Y_Mrm03.png =700x) ---- ## 比較 ![](https://hackmd.io/_uploads/SJZZES7C2.png) --- ## install ```bash= $ curl -sSL https://get.docker.com/ubuntu/ | sudo sh ``` --- ## images(映像) 例如:一個映像檔可以包含一個完整的 ubuntu 作業系統環境,裡面僅安裝了使用者需要的其它應用程式。 --- ## container(容器) 容器是從映像檔建立的執行實例。它可以被啟動、開始、停止、刪除。每個容器都是相互隔離的平台。 --- ## registry(倉庫) ### Docker Hub => [link](https://hub.docker.com/) ![](https://hackmd.io/_uploads/H1GSH-_R2.png) --- ## docker pull(取得映像檔) ```bash $ docker pull bcbcarl/hollywood ``` ![](https://hackmd.io/_uploads/rJmttgDSp.png) ---- ## docker images(列出) ```bash $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE isg latest e13fd8a649e8 3 days ago 3.68GB mcr.microsoft.com/devcontainers/base jammy 46ddc7dc0a15 3 months ago 661MB fathyb/carbonyl latest 173e471b5251 9 months ago 274MB bcbcarl/hollywood latest 8a85ac985999 5 years ago 533MB ``` --- ## dockerfile ---- FROM ```dockerfile FROM <image> FROM <image>:<tag> ``` example: ```dockerfile FROM ubuntu ``` ![Screenshot 2023-12-01 at 2.35.20 PM](https://hackmd.io/_uploads/BkIhAgDrp.png =700x) ---- RUN ```dockerfile RUN <command> RUN ["executable", "<param1>", "<param2>"] ``` example: ```dockerfile RUN apt update\ && apt upgrade ``` ---- ENV ```dockerfile ENV <key> <value> ``` example ```dockerfile ```
{"title":"Docker","description":"explain what is Docker","contributors":"[{\"id\":\"e0c7dab8-be31-4e15-a8e7-22968131e3e1\",\"add\":2727,\"del\":958}]"}
    305 views
   Owned this note