docker 笔记

架构

  • 镜像:打包好的模板
  • 容器:镜像的具体实例
  • 仓库:镜像库

使用

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# 拉取镜像
docker pull diygod/rsshub
# 带参数运行
docker run -d --name rsshub -p 1200:1200 -e DEBUG_INFO=false diygod/rsshub
# 查看容器
docker ps
# 停止容器
docker stop rsshub
# 移除容器
docker rm rsshub

参数

-d 后台模式 -t -i 交互模式 (-t 终端 ) -e 环境变量 –name 容器命名 (未命名时,可以直接通过 容器id 操作)

docker 与 k8s

Docker 使用手记

启动异常

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
service docker status

● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: failed (Result: start-limit-hit) since Mon 2019-02-25 21:32:47 CST; 22min ago
     Docs: https://docs.docker.com
  Process: 1884 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=1/FAILURE)
 Main PID: 1884 (code=exited, status=1/FAILURE)

Feb 25 21:32:47 ubuntu systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 21:32:47 ubuntu systemd[1]: Failed to start Docker Application Container Engine.
Feb 25 21:32:47 ubuntu systemd[1]: docker.service: Unit entered failed state.
Feb 25 21:32:47 ubuntu systemd[1]: docker.service: Failed with result 'exit-code'.
Feb 25 21:32:47 ubuntu systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Feb 25 21:32:47 ubuntu systemd[1]: Stopped Docker Application Container Engine.
Feb 25 21:32:47 ubuntu systemd[1]: docker.service: Start request repeated too quickly.
Feb 25 21:32:47 ubuntu systemd[1]: Failed to start Docker Application Container Engine.
Feb 25 21:32:47 ubuntu systemd[1]: docker.service: Unit entered failed state.
Feb 25 21:32:47 ubuntu systemd[1]: docker.service: Failed with result 'start-limit-hit'.

看不出来啥。

用 dockerd 直接启动

参考思路

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
[email protected]:~# dockerd
INFO[2019-02-25T22:22:17.415498593+08:00] parsed scheme: "unix"                         module=grpc
INFO[2019-02-25T22:22:17.415612679+08:00] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2019-02-25T22:22:17.415648749+08:00] parsed scheme: "unix"                         module=grpc
INFO[2019-02-25T22:22:17.415666257+08:00] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2019-02-25T22:22:17.416118293+08:00] ccResolverWrapper: sending new addresses to cc: [{unix:///run/containerd/containerd.sock 0  <nil>}]  module=grpc
INFO[2019-02-25T22:22:17.416141064+08:00] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2019-02-25T22:22:17.416198241+08:00] pickfirstBalancer: HandleSubConnStateChange: 0xc42002e170, CONNECTING  module=grpc
INFO[2019-02-25T22:22:17.417227322+08:00] pickfirstBalancer: HandleSubConnStateChange: 0xc42002e170, READY  module=grpc
INFO[2019-02-25T22:22:17.417533555+08:00] ccResolverWrapper: sending new addresses to cc: [{unix:///run/containerd/containerd.sock 0  <nil>}]  module=grpc
INFO[2019-02-25T22:22:17.417642983+08:00] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2019-02-25T22:22:17.417754596+08:00] pickfirstBalancer: HandleSubConnStateChange: 0xc42002e430, CONNECTING  module=grpc
INFO[2019-02-25T22:22:17.417920121+08:00] pickfirstBalancer: HandleSubConnStateChange: 0xc42002e430, READY  module=grpc
ERRO[2019-02-25T22:22:17.418565532+08:00] AUFS was not found in /proc/filesystems       storage-driver=aufs
ERRO[2019-02-25T22:22:17.418581131+08:00] [graphdriver] prior storage driver aufs failed: driver not supported 
Error starting daemon: error initializing graphdriver: driver not supported

分别 谷歌 后三行,

stackoverflow.com

Try removing all downloaded images:

sudo rm /var/lib/docker/aufs -rf That helped me to recover docker after a kernel update.

Related issues on the github:

https://github.com/docker/docker/issues/14026 https://github.com/docker/docker/issues/15651

原因:

a kernel update

安装bbr时,升级了内核。