Centos6.5安裝和使用docker

rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum install docker-io -y
service docker on 
chkconfig docker on

原本是想使用centos7.2玩docker,筆記本上沒裝,先用centos6.5玩一玩。python

docker經常使用命令:docker

docker pull ubuntu #從Docker Hub的Ubuntu倉庫下載最新的Ubuntu操做系統ubuntu

docker pull ubuntu:14.04 #指定標籤下載特定版本的某一鏡像centos

docker images #列出本地主機上已有的鏡像centos7

docker inspect ID號  #獲取鏡像的詳細信息操作系統

docker search TERM #搜索鏡像blog

 支持的經常使用參數:--automated=false 僅顯示自動建立的鏡像input

                       --no-trunc=false 輸出信息不截斷顯示it

                       -s 指定僅顯示評定爲指定星級以上的鏡像io

docker rmi IMAGE #刪除鏡像 參數有 -f 表示強行刪除鏡像

---------------------------------------------------------------------------------------

docket重要操做命令

建立鏡像

建立鏡像有三種方法:基於已有鏡像的容器建立、基於本地模板導入、基於Dockerfile建立

基於已有鏡像的容器導入:

docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]],主要選項包括:

-a  做者信息

-m 提交信息

-p 提交時暫停容器運行

基於本地模板導入:

從一個操做系統模板文件導入一個鏡像,例如:

cat ubuntu-14.04-x86_64-minimal.tar.gz | docker import - ubuntu:14.04

---------------------------------------------------------------------------------------

存出和載入鏡像

例如:存出本地的ubuntu:14.04鏡像文件爲ubuntu_14.04.tar

docker save -o ubuntu_14.04.tar ubuntu:14.04

載入鏡像:

例如:從文件ubuntu_14.04.tar導入鏡像到本地鏡像列表

docker load --input ubuntu_14.04.tar 或

docker load < ubuntu_14.04.tar

---------------------------------------------------------------------------------------

上傳鏡像

例如用戶user上傳本地的test:latest鏡像,能夠先添加新的標籤user/test:latest,而後用docker push命令上傳鏡像

docker tag test:latest user/test:latest

未完待續。。。。

相關文章
相關標籤/搜索