Docker 资源汇总

in #cn7 years ago

os docker

dockerfile

tutorial

查看日志

  • docker logs -f my-container-name 类似 tail -f
  • docker logs -n 10 my-container-name 显示最近 10 行.

公有云服务

docker image 存放目录

  • /var/lib/docker 下文件可以清理掉, 然后重新 docker pull.

docker 的简单介绍

layer 分析工具

文件系统

  • AUFS
  • 写时拷贝 (copy-on-write)
  • 数据卷 (volume)
  • docker volume 命令

网络

docker 使用上的建议

  • tag 不要用 latest
  • 使用提供 dockerfile 的镜像 (为了安全)

docker 官方组件的简单介绍

  • machine
  • compose
  • swarm

dockerfile 的介绍

如何使用 dockerfile

  • build
  • 执行 docker build -f <dockerfile> <build-context-path> 构建镜像 (image), 构建镜像需要一个 Dockerfile 文件和一个构建上下文 (build context).
  • Dockerfile 是一系列 docker 命令, 用于按步骤构建 docker 容器, 然后再导出一份镜像. 构建上下文会被发送给 docker daemon, 用于 ADD, COPY 等命令操作. 所以注意不要把 / 目录或者其他过大的目录作为构建上下文.

编写 dockerfile 的最佳实践

注意中间层镜像

  • 尽可能连用 LABEL, ENV, RUN 等命令, 因为每次执行一行命令, 都会产生一个新的镜像.
  • 尽量这么写
LABEL home="http://gitlab.widget-inc.com/her/her-gateway" \
      private="true"

ENV GATEWAY_VERSION="0.19.3" \
    NODE_VERSION="0.12.9"

RUN addgroup -S redis && adduser -S -G redis redis
  • 而不是:
LABEL home http://gitlab.widget-inc.com/her/her-gateway
LABEL private true

ENV GATEWAY_VERSION 0.19.3
ENV NODE_VERSION 0.12.9

RUN addgroup -S redis
RUN adduser -S -G redis redis

init 进程

是否要启动 sshd

是否要启动守护进程

日志转发

使用基础镜像

最佳实践

轻量级, 应用级的容器

docker 生态圈

  • containerd: containerd is a daemon to control runC, built for performance and density.
  • coreos
  • rkt
  • kubernetes
  • mesos

docker生态

国内镜像

forum

tutorial

tools

源码分析

root

还有要有人回答下,docker服务端和客户端需要通过/var/run/docker.sock通信,这个目录需要root才能读写
我也尝试过chmod这个文件,以后客户端不用root也可以正常地执行命令

book

docker vs vagrant

OS X GUI for Docker

courses

Sort:  

Congratulations @akagi201! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You made your First Vote
You published your First Post
You got a First Vote

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Coin Marketplace

STEEM 0.17
TRX 0.13
JST 0.026
BTC 58216.02
ETH 2614.69
USDT 1.00
SBD 2.45