MAC 上的 docker desktop 踩坑筆記

安裝後需要先辦帳號

https://www.docker.com/

打開介面後,Terminal 在右下角可以開啟

輸入以下指令可以在官方倉庫中搜尋映像檔

docker search nginx
會列出
bash-3.2$ docker search nginx
NAME                               DESCRIPTION                                     STARS     OFFICIAL
nginx                              Official build of Nginx.                        20038     [OK]
unit                               Official build of NGINX Unit: Universal Web …   33        [OK]
nginx/nginx-ingress                NGINX and  NGINX Plus Ingress Controllers fo…   92        
nginxinc/nginx-unprivileged        Unprivileged NGINX Dockerfiles                  155       
nginx/nginx-prometheus-exporter    NGINX Prometheus Exporter for NGINX and NGIN…   42        
nginx/unit                         This repository is retired, use the Docker o…   63        
nginxinc/nginx-s3-gateway          Authenticating and caching gateway based on …   6         
nginx/nginx-ingress-operator       NGINX Ingress Operator for NGINX and NGINX P…   2         
nginx/nginx-quic-qns               NGINX QUIC interop                              1         
nginxinc/amplify-agent             NGINX Amplify Agent docker repository           1         
nginxinc/ingress-demo              Ingress Demo                                    4         
nginxproxy/nginx-proxy             Automated nginx proxy for Docker containers …   143       
nginx/unit-preview                 Unit preview features                           0         
nginxproxy/acme-companion          Automated ACME SSL certificate generation fo…   137       
bitnami/nginx                      Bitnami container image for NGINX               193       
ubuntu/nginx                       Nginx, a high-performance reverse proxy & we…   115       
nginxinc/mra-fakes3                                                                0         
kasmweb/nginx                      An Nginx image based off nginx:alpine and in…   8         
nginxproxy/docker-gen              Generate files from docker container meta-da…   17        
bitnami/nginx-ingress-controller   Bitnami container image for NGINX Ingress Co…   34        
bitnami/nginx-exporter             Bitnami container image for NGINX Exporter      5         
rancher/nginx                                                                      2         
nginxinc/ngx-rust-tool                                                             0         
nginxinc/mra_python_base      

安裝使用這個

docker pull nginx

如果遇到驗證問題,代表沒有在terminal 登入… (failed to authorize)
用這個可以登入

docker login

登入後會給 Login Succeeded,就可以 pull 了

接下來在Images 頁面就會跑出剛剛pull 的 image,這邊是映像檔,可以拿來部署

按下右邊的Actions 的三角形可以使用這個Image 產生出一個Container (執行用的個體)

這個頁面表示,該image 自己會開一個80 port (以內部來看),然後我們要設定一個 container 對外的port 來轉接進去

確定後,就會在Container 中找到剛剛的實體

按下Actions 的三角形就會開始服務

在本機的瀏覽器輸入 http://localhost:9080/

就會看到以下畫面

發佈留言