docker 入坑3

查看镜像

docker images [OPTIONS] [REPOSITORY[:TAG]]
  •  -a, --all=false
  • -f, --filter=[]
  • --no-trunc=false
  • -q, --quite=false

删除镜像

$ docker rmi [OPTIONS] IMAGE

 检索镜像

$ docker search [OPTIONS] TERM
--automated=false	Only show automated builds
--no-trunc=false	Don't truncate output
-s, --stars=0	Only displays with at least x stars

 构建镜像

  1. $ docker commit 通过容器构建
  2. $ docker build 通过Dockerfile文件构建
$ docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
-a, --author=""	通常填写作者以及联系方式
-m,--message	Commit message
-p, --pause=true	Pause container during commit

 eg:

$ docker run -it -p 80 --name commit_test ubuntu /bin/bash

 安装nginx

# apt-get update
# apt-get install nginx

 退出

docker commit -a '取名' -m 'nginx' commit_test 仓库名字/镜像名字
$ docker commit -a 'Mantishell' -m 'nginx' commit_test mantishell/commit_test
$ docker images
$ docker run -d --name nginx_web -p 80 mantishell/commit_test nginx -g "daemon off;"
$ docker ps

猜你喜欢

转载自www.cnblogs.com/mantishell/p/11294975.html