Docker构建需要太长时间

时间:2014-05-29 21:56:26

标签: docker

我的Dockerfiles中的某些说明耗时太长。例如,使用ADD指令添加3行文件或将行回显到文件中有时需要一分钟以上。

导致这种情况的原因是什么?

这是我的系统日志,不确定是否相关:

May 29 18:45:17 mymachine kernel: [97813.649053] EXT4-fs (dm-3): mounted filesystem with ordered data mode. Opts: discard
May 29 18:45:54 mymachine kernel: [97850.627286] EXT4-fs (dm-3): mounted filesystem with ordered data mode. Opts: discard
May 29 18:45:55 mymachine kernel: [97851.249484] EXT4-fs (dm-4): mounted filesystem with ordered data mode. Opts: discard
May 29 18:46:34 mymachine console-kit-daemon[983]: GLib-CRITICAL: Source ID 5102 was not found when attempting to remove it
May 29 18:46:53 mymachine kernel: [97908.977215] EXT4-fs (dm-2): mounted filesystem with ordered data mode. Opts: discard
May 29 18:46:53 mymachine kernel: [97909.217137] EXT4-fs (dm-2): mounted filesystem with ordered data mode. Opts: discard
May 29 18:46:53 mymachine kernel: [97909.247252] EXT4-fs (dm-3): mounted filesystem with ordered data mode. Opts: discard
May 29 18:47:26 mymachine kernel: [97942.607378] EXT4-fs (dm-3): mounted filesystem with ordered data mode. Opts: discard
May 29 18:47:26 mymachine kernel: [97942.767831] EXT4-fs (dm-4): mounted filesystem with ordered data mode. Opts: discard
May 29 18:48:36 mymachine kernel: [98012.632630] EXT4-fs (dm-2): mounted filesystem with ordered data mode. Opts: discard
May 29 18:48:37 mymachine kernel: [98013.681835] EXT4-fs (dm-2): mounted filesystem with ordered data mode. Opts: discard
May 29 18:48:38 mymachine kernel: [98014.009612] netlink: 1 bytes leftover after parsing attributes.
May 29 18:48:38 mymachine kernel: [98014.016816] device vethb49f entered promiscuous mode
May 29 18:48:38 mymachine kernel: [98014.020408] IPv6: ADDRCONF(NETDEV_UP): vethb49f: link is not ready
May 29 18:48:38 mymachine kernel: [98014.046745] IPv6: ADDRCONF(NETDEV_CHANGE): vethb49f: link becomes ready
May 29 18:48:38 mymachine kernel: [98014.046785] docker0: port 2(vethb49f) entered forwarding state
May 29 18:48:38 mymachine kernel: [98014.046791] docker0: port 2(vethb49f) entered forwarding state
May 29 18:48:39 mymachine kernel: [98015.128850] EXT4-fs (dm-3): mounted filesystem with ordered data mode. Opts: discard
May 29 18:48:39 mymachine kernel: [98015.174370] docker0: port 2(vethb49f) entered disabled state
May 29 18:48:39 mymachine kernel: [98015.174860] device vethb49f left promiscuous mode
May 29 18:48:39 mymachine kernel: [98015.174867] docker0: port 2(vethb49f) entered disabled state
May 29 18:49:18 mymachine kernel: [98054.703978] EXT4-fs (dm-3): mounted filesystem with ordered data mode. Opts: discard
May 29 18:49:18 mymachine kernel: [98054.834326] EXT4-fs (dm-4): mounted filesystem with ordered data mode. Opts: discard
May 29 18:50:14 mymachine kernel: [98110.408736] EXT4-fs (dm-2): mounted filesystem with ordered data mode. Opts: discard
May 29 18:50:15 mymachine kernel: [98111.221056] EXT4-fs (dm-2): mounted filesystem with ordered data mode. Opts: discard
May 29 18:50:15 mymachine kernel: [98111.443577] EXT4-fs (dm-3): mounted filesystem with ordered data mode. Opts: discard
May 29 18:50:44 mymachine kernel: [98140.675447] EXT4-fs (dm-3): mounted filesystem with ordered data mode. Opts: discard
May 29 18:50:44 mymachine kernel: [98140.695348] EXT4-fs (dm-4): mounted filesystem with ordered data mode. Opts: discard
May 29 18:51:36 mymachine kernel: [98192.027431] EXT4-fs (dm-2): mounted filesystem with ordered data mode. Opts: discard
May 29 18:51:36 mymachine kernel: [98192.559271] EXT4-fs (dm-2): mounted filesystem with ordered data mode. Opts: discard
May 29 18:51:36 mymachine kernel: [98192.800718] netlink: 1 bytes leftover after parsing attributes.
May 29 18:51:36 mymachine kernel: [98192.881484] device veth000f entered promiscuous mode
May 29 18:51:36 mymachine kernel: [98192.881966] IPv6: ADDRCONF(NETDEV_UP): veth000f: link is not ready
May 29 18:51:36 mymachine kernel: [98192.945999] IPv6: ADDRCONF(NETDEV_CHANGE): veth000f: link becomes ready
May 29 18:51:36 mymachine kernel: [98192.946045] docker0: port 2(veth000f) entered forwarding state
May 29 18:51:36 mymachine kernel: [98192.946051] docker0: port 2(veth000f) entered forwarding state
May 29 18:51:37 mymachine kernel: [98193.274007] docker0: port 2(veth000f) entered disabled state
May 29 18:51:37 mymachine kernel: [98193.275061] device veth000f left promiscuous mode
May 29 18:51:37 mymachine kernel: [98193.275068] docker0: port 2(veth000f) entered disabled state
May 29 18:51:37 mymachine kernel: [98193.319695] EXT4-fs (dm-3): mounted filesystem with ordered data mode. Opts: discard
May 29 18:52:17 mymachine kernel: [98233.520926] EXT4-fs (dm-3): mounted filesystem with ordered data mode. Opts: discard
May 29 18:52:17 mymachine kernel: [98233.608787] EXT4-fs (dm-4): mounted filesystem with ordered data mode. Opts: discard

Docker信息:

Containers: 2
Images: 172
Storage Driver: devicemapper
 Pool Name: docker-202:1-1447309-pool
 Data file: /var/lib/docker/devicemapper/devicemapper/data
 Metadata file: /var/lib/docker/devicemapper/devicemapper/metadata
 Data Space Used: 4443.4 Mb
 Data Space Total: 102400.0 Mb
 Metadata Space Used: 9.4 Mb
 Metadata Space Total: 2048.0 Mb
Execution Driver: native-0.2
Kernel Version: 3.13.0-24-generic
WARNING: No swap limit support

1 个答案:

答案 0 :(得分:3)

你在运行哪个Docker后端? AUFS?设备映射? BTRFS? ...?

如果您的操作系统支持它,切换到AUFS后端可能会对此有所帮助。

更权威的答案需要知道您正在使用哪个后端,您所依赖的系统的性能特征,以及可能的调用跟踪(例如sysdig可以生成的内容)。