#檢視容器ID(containedId)
$docker ps -a
#删除容器
$docker rm containedId
#停止運作的容器
$docker stop containedId
#修改容器後将容器儲存成鏡像
$docker commit containedId supermap9d:v1
#建立容器并進入互動式模式
$docker run -it registry:versionid /bin/bash
#檢視鏡像
$docker images
#删除鏡像
$docker rmi imageid 或則 docker rmi registry:versionid
使用docker鏡像nginx:latest以背景模式啟動一個容器,并将容器命名為mynginx。
docker run --name mynginx -d nginx:latest
使用鏡像 nginx:latest,以背景模式啟動一個容器,将容器的 80 端口映射到主機的 80 端口,主機的目錄 /data 映射到容器的 /data。
docker run -p 80:80 -v /data:/data -d nginx:latest
綁定容器的 8080 端口,并将其映射到本地主機 127.0.0.1 的 80 端口上。
docker run -p 127.0.0.1:80:8080/tcp ubuntu bash
使用鏡像nginx:latest以互動模式啟動一個容器,在容器内執行/bin/bash指令。
runoob@runoob:~$ docker run -it nginx:latest /bin/bash
#主機複制檔案到docker的[/path]路徑
$docker cp localhostfile containedId:/path
#登入阿裡雲docker registry:
$docker login [email protected] registry.cn-hangzhou.aliyuncs.com 密碼:Ak610152753
有任何需要溝通交流的聯系QQ群:276483863
加好友備注【部落格園技術交流】