1 clone
docker run --name repo alpine/git clone https://github.com/docker/getting-started.git docker cp repo:/git/getting-started/ .
2 build
cd getting-started docker build -t docker101tutorial .
3 run
docker run -d -p 80:80 --name docker-tutorial docker101tutorial
4 share
docker tag docker101tutorial {userName}/docker101tutorial docker push {userName}/docker101tutorial
docker --version
# 登录 docker hub docker login # 登录指定 registry docker login xxx.com
docker image ls docker images
docker ps docker ps --all
docker run hello-world # --publish,将宿主机的 8000 端口映射到容器的 8080 端口 # --detach,后台运行 # --name,指定容器的名称 docker run --publish 8000:8080 --detach --name bb bulletinboard:1.0 # 运行一次立即退出 docker run -it --rm bulletinboard:1.0 /bin/bash
docker stop bb
# --force,可以删除正在运行中的容器 docker rm --force bb
# 根据 Dockerfile 生成镜像 docker build --tag bulletinboard:1.0 docker build --tag bulletinboard:1.0 . # 使用修改后的容器生成镜像(保存容器) docker commit -a "runoob.com" -m "my apache" a404c6c174a2 mymysql:v1
docker tag bulletinboard:1.0 <Your Docker ID>/bulletinboard:1.0 docker push <Your Docker ID>/bulletinboard:1.0
repo_tag="abcdefg" docker rmi -f $(docker images|grep $repo_tag|awk '{print $3}'|uniq)