[Docker] 基本操作及實作一分鐘安裝NGINX
目前docker中可用映像檔:https://registry.hub.docker.com 如:Debian、CentOS、MongoDB、MySQL、NGINX、PostgresSQL、Node.js、redis
*查詢centos映像檔
docker search centos
*下載centos映像檔
docker pull centos
*查詢已下載映像檔
docker images
*執行centos映像檔成Container
docker run --name=myContainer –t –i centos:latest /bin/bash
*查詢目前執行中的Container
docker ps -a
*停止Container
docker stop container_id
*啟動Container
docker start container_id
*刪除Container
docker rm container_id (強制-f)
*重新啟動後進入container
docker exec –ti container_id
*儲存並匯出自訂的container
docker export container_id > mycontainer.tar
*匯入自訂container
cat mycontainer.tar | docker import – centos:mycentos
*設定對外映射
docker run --name=mycontainer –p 22:2222 –t –i centos:mycentos /bin/bash
時做一分鐘安裝NGINX
docker pull nginx
docker run --name=myNGINX –d –p 8080:80 nginx:latest
開啟網頁瀏覽測試http://ip:8080
參考:http://www.netadmin.com.tw/article_content.aspx?sn=1503060001&jump=4