Docker is a set of platform as a service (PaaS) products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels. All containers are run by a single operating system kernel and therefore use fewer resources than virtual machines.
- Official docker docs
- Docker guide
- Docker Curriculum🐬 A comprehensive tutorial on getting started with Docker!
- Docker 入门教程
- Docker Cheat Sheet
- 使用 DaoCloud,选择自己的主机,安装好后就是从 DaoCloud 拉取 images 了。
-
选择最小的适合的 image 开始,比如 golang,就直接使用
FROM golang:latest
-
尽可能压缩会生成文件的命令调用,因为每一个 Dockerfile 命令,都会建立一个版本镜像,所以尽量将
COPY
ADD
CMD
RUN
等命令归到一行,比如RUN go install agent RUN rm -rf pkg src .godeps
就要合并成一行
RUN go install agent && rm -rf pkg src .godeps
-
使用 .dockerignore,这败家玩意儿,简直活脱脱就是个 .gitignore,语法姨妈一样,一般 build golang 会这么写
COPY .godeps /go/.godeps COPY src /go/src
相应的 .dockerignore 这么写
.git pkg bin .godeps/pkg .godeps/bin
- DockerSlim (docker-slim): Don't change anything in your Docker container image and minify it by up to 30x (and for compiled languages even more) making it secure too! (free and open source) https://dockersl.im
- Awesome Docker🐳 A curated list of Docker resources and projects