docker 命令
Durant35 opened this issue · comments
Gary Chan commented
- 查看一个docker镜像完整信息
- Volume挂载
- 进入container宿主
- 多容器应用
- 移除镜像,释放空间
- docker磁盘存储查看&管理
- docker build
- docker push&pull
- docker tag 为Image更新/打tag
- 构建镜像
Gary Chan commented
查看一个docker镜像完整信息
docker inspect <IMAGE ID>
Gary Chan commented
Volume挂载
$ docker run -v
Gary Chan commented
进入container宿主
$ docker exec -it CONTAINER COMMAND /bin/bash
Gary Chan commented
多容器应用
# 基于docker的应用 docker-compose
Gary Chan commented
移除镜像,释放空间
docker image rm -f <image-id>
Gary Chan commented
docker磁盘存储查看&管理
- 查看 Docker 的磁盘使用情况
$ docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 147 36 7.204GB 3.887GB (53%)
Containers 37 10 104.8MB 102.6MB (97%)
Local Volumes 3 3 1.421GB 0B (0%)
Build Cache 0B 0B
- 只是清理dangling 镜像 (Docker remove TAG images) && clear cache
$ docker image prune
- 清理磁盘,删除关闭的容器、无用的数据卷和网络,以及 dangling 镜像(即无 tag 的镜像)
# 使用前需谨慎!!!
$ docker system prune -a
Gary Chan commented
docker push&pull
- push
$ docker login -u admin -p senseauto@harbor harbor.senseauto.com
$ docker push core.harbor.domain/senseauto/developer:v1.3-lint-driveworks-2.0
- pull
$ docker login -u developer -p Goodsense@2019 harbor.senseauto.com
$ docker pull core.harbor.domain/senseauto/developer:v1.3-lint-driveworks-2.0
Gary Chan commented
docker tag
$ docker tag 490655537474 \
core.harbor.domain/senseauto/developer:v1.3-lint-driveworks-2.0
If your image is tagged with more than one tag, then docker rmi will remove the tag, but not the image.
# not image id!!!
$ docker rmi <your-tag>
Gary Chan commented
镜像构建
基于container加layer构造新镜像
$ docker commit -a "chenshengjie <chenshengjie@senseauto.com>" senseauto-dw3.5-build harbor.senseauto.com/senseauto/developer:cuda10.2-driveworks3.5
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
harbor.senseauto.com/senseauto/developer cuda10.2-driveworks3.5 4e11512492b8 3 minutes ago 25.6GB
harbor.senseauto.com/senseauto/developer cuda10.2-driveworks2.2 2d9f12c60092 2 months ago 20.2GB
...
基于Dockerfile自动构建镜像
docker build -f Dockerfile-weride \
-t core.harbor.domain/senseauto/developer:v1.3-lint-weride .