LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.
Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away from poor people.
talk is cheap, show others the code and KPI, Keep progress,make a better result.
Survive during the day and develop at night。
目录
概 述
通常对应的根据操作手册就可以部署对应的容器。
在公司中一般都有对应的准生产容器平台。
提供了命令行和界面2种方式部署项目。
docker容器命令:
docker–help
一.通用命令
docker --help 命令----可以快速查看命令的用法
用法: docker [OPTIONS] COMMAND
我们可以通过docker images --help查看所有的docker 镜像相关的命令
docker images
-a : 列出本地所有的镜像(含中间镜像层) 表示的是all的含义
-q : 只显示镜像ID
–digests: 显示镜像的摘要信息
–no-trunc:显示完整的镜像信息
docker images -q : 查询镜像的ID
搜素镜像:
docker search 镜像名:
拉取镜像:
docker pull 镜像名称[:tag]
tag是可选项, 不填表示latest
- 删除镜像
docker rmi -f hello-world
容器的基本命令:
docker run -p 8080:80 -d daocloud.io/nginx
docker run是启动容器. 启动的时候, 现在本地查找镜像, 如果本地没有, 则去网络下载
–name: 容器名字
-d: 表示以后台进程运行.
-p 8080:80 是把虚拟机中启动的nginx的端口号80 映射到本机的8080
-P: 随机端口映射
-i: 以交互模式运行容器, 通常与-t同时使用
-t: 为容器重新分配一个伪输入终端, 通常与-i同时使用
-it: 使用交互方式运行,进入容器查看内容
docker run -it centos /bin/bash
- 查询正在运行的容器
docker ps
docker stop 容器id
查看容器中的进程
docker top 容器id - 查看镜像的元数据
docker inspect 容器id
重要:
4. 启动守护式容器
docker run -d 容器名
-
查看容器日志
docker logs -f -t --tail 数字 容器ID -
查看容器内运行的进程
docker top 容器id -
查看容器内部的细节
-
docker inspect 容器ID
9.从容器内拷贝文件到主机上:
docker cp 容器ID:容器内路径 目标主机地址
小结
参考
资料和推荐阅读
1.链接: 参考资料.