-
什么是docker
docker is the world’s leading software containerization platform
开源在github上
跨平台 支持 linux windows maxos1、集装箱
2、标准化
1.运输方式:超级码头
2.存储方式:标准化
3.API接口:
3、隔离 -
理解Docker
解决什么问题:
1.环境配置
2.用户隔离,功能隔离
3.快速扩展、弹性伸缩 -
走进Docker
build 镜像:集装箱
ship 仓库:超级码头
run 容器:运行程序的地方
docker image:文件
联合文件系统 Union FS
docker container: 进程
docker repository: hub.docker.com / c.163.comdocker version:
Client: Docker Engine - Community
Version: 18.09.2
API version: 1.39
Go version: go1.10.8
Git commit: 6247962
Built: Sun Feb 10 04:12:39 2019
OS/Arch: darwin/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.2
API version: 1.39 (minimum version 1.12)
Go version: go1.10.6
Git commit: 6247962
Built: Sun Feb 10 04:13:06 2019
OS/Arch: linux/amd64
Experimental: true
- Hello World
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
- Nginx服务
1、持久运行容器
2、前台挂起&后台运行
3、进入容器内部
docker exec -it 21 bash 对已运行的容器执行命令
-d 后台运行
-i 交互
-t 伪终端
网络:
网络类型 net namespace
bridge
host 宿主机同步
none 不通讯
端口映射
- Docker化的Java web
制作自己的镜像:
Dockerfile:
docker build:
开源应用:Jpress:http://jpress.io/