《Docker —— 從入門到實踐­》正體中文版
  • 前言
  • Docker 簡介
    • 什麼是 Docker
    • 為什麼要用 Docker
  • 基本概念
    • 映像檔
    • 容器
    • 倉庫
  • 安裝
    • Ubuntu
    • CentOS
  • 映像檔
    • 取得映像檔
    • 列出
    • 建立
    • 儲存和載入
    • 移除
    • 實作原理
  • 容器
    • 啟動
    • 常駐執行
    • 終止
    • 進入容器
    • 匯出與匯入
    • 刪除
  • 倉庫
    • Docker Hub
    • 私有倉庫
    • 設定檔案
  • 資料管理
    • 資料卷
    • 資料卷容器
    • 備份、恢復、遷移資料卷
  • 使用網路
    • 外部存取容器
    • 容器互連
  • 進階網路設定
    • 快速設定指南
    • 設定 DNS
    • 容器存取控制
    • 埠號映射實作
    • 設定 docker0 橋接器
    • 自訂橋接器
    • 工具與範例
    • 編輯網路設定檔案
    • 實例:創造一個點對點連線
  • 實戰案例
    • 使用 Supervisor 來管理程式
    • 建立 tomcat/weblogic 集群
    • 多台實體主機之間的容器互連
    • 標準化開發測試和生產環境
  • 安全
    • 核心命名空間
    • 控制組
    • 伺服端防護
    • 核心能力機制
    • 其他安全特性
    • 總結
  • Dockerfile
    • 基本結構
    • 指令
    • 建立映像檔
    • 從映像檔產生 Dockerfile
  • 底層實作
    • 基本架構
    • 命名空間
    • 控制組
    • Union 檔案系統
    • 容器格式
    • 網路
  • 附錄一:命令查詢
  • 附錄二:常見倉庫介紹
    • Ubuntu
    • CentOS
    • MySQL
    • MongoDB
    • Redis
    • Nginx
    • WordPress
    • Node.js
  • 附錄三:資源連結
Powered by GitBook
On this page

Was this helpful?

  1. 映像檔

取得映像檔

可以使用 docker pull 命令從倉庫取得所需要的映像檔。

下面的例子將從 Docker Hub 倉庫下載一個 Ubuntu 12.04 作業系統的映像檔。

$ sudo docker pull ubuntu:12.04
Pulling repository ubuntu
ab8e2728644c: Pulling dependent layers
511136ea3c5a: Download complete
5f0ffaa9455e: Download complete
a300658979be: Download complete
904483ae0c30: Download complete
ffdaafd1ca50: Download complete
d047ae21eeaf: Download complete

下載過程中,會輸出取得映像檔的每一層訊息。

該命令實際上相當於 $ sudo docker pull registry.hub.docker.com/ubuntu:12.04 命令,即從註冊服務器 registry.hub.docker.com 中的 ubuntu 倉庫來下載標記為 12.04 的映像檔。

有時候官方倉庫註冊服務器下載較慢,可以從其他倉庫下載。 從其它倉庫下載時需要指定完整的倉庫伺服器位址。例如

$ sudo docker pull dl.dockerpool.com:5000/ubuntu:12.04
Pulling dl.dockerpool.com:5000/ubuntu
ab8e2728644c: Pulling dependent layers
511136ea3c5a: Download complete
5f0ffaa9455e: Download complete
a300658979be: Download complete
904483ae0c30: Download complete
ffdaafd1ca50: Download complete
d047ae21eeaf: Download complete

完成後,即可隨時使用該映像檔了,例如建立一個容器,讓其中執行 bash。

$ sudo docker run -t -i ubuntu:12.04 /bin/bash
root@fe7fc4bd8fc9:/#
Previous映像檔Next列出

Last updated 5 years ago

Was this helpful?