系统里多出来一个镜像,是rails的最新版
代码语言:javascript复制[root@h104 ~]# docker images | grep rails
rails latest afdddae9b2bf 46 hours ago 833.7 MB
[root@h104 ~]#
不得不说,还是有点大的 833.7 MB,相较而言一个完整的rails应用代码才区区几兆
代码语言:javascript复制[root@h202 ruby]# du -sh blog/
2.0M blog/
[root@h202 ruby]#
可见 Rails 框架帮我们完成了多少额外工作,我们的核心代码也因此而精简
反观,Rails的框架依赖有多么臃肿,整个一大胖子,应该也是反映慢的原因之一吧
不过话说回来,正因为这些基础,这个应用可以自立根生,除了系统内核和Docker提供的隔离环境,它的运行不再看其它环境或基础设施的脸色,可以独立运行了
Tip: 同时,它依赖的那么多层基础镜像是可以和其它容器共享的,并非每次都是成倍的磁盘空间需求,大量相似容器的环境中,一定程度上还节约了磁盘空间
可以看看镜像的详细内容
代码语言:javascript复制[root@h104 blog2]# docker inspect afdddae9b2bf
[
{
"Id": "afdddae9b2bf7469476e271850590aaee2e2c7353121e2801f4c3bd35b30e324",
"RepoTags": [
"rails:latest"
],
"RepoDigests": [],
"Parent": "fc2eabed675c24b767c4d78dfad2c8a525f778e06a81278a169e262e4ccc9eff",
"Comment": "",
"Created": "2016-04-27T17:18:03.953130492Z",
"Container": "af60debb03e6f61c0e0d5875dd3859408151d335c59abf4e9ff986b3ada4c517",
"ContainerConfig": {
"Hostname": "bcad5a346f31",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/bundle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"RUBY_MAJOR=2.3",
"RUBY_VERSION=2.3.1",
"RUBY_DOWNLOAD_SHA256=b87c738cb2032bf4920fef8e3864dc5cf8eae9d89d8d523ce0236945c5797dcd",
"RUBYGEMS_VERSION=2.6.3",
"BUNDLER_VERSION=1.11.2",
"GEM_HOME=/usr/local/bundle",
"BUNDLE_PATH=/usr/local/bundle",
"BUNDLE_BIN=/usr/local/bundle/bin",
"BUNDLE_SILENCE_ROOT_WARNING=1",
"BUNDLE_APP_CONFIG=/usr/local/bundle",
"RAILS_VERSION=4.2.6"
],
"Cmd": [
"/bin/sh",
"-c",
"gem install rails --version "$RAILS_VERSION""
],
"Image": "5da847340e289b1357164d7a9f62ac6e67a557c63c4cb2c8823b4cb341776e15",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": [],
"Labels": {}
},
"DockerVersion": "1.9.1",
"Author": "",
"Config": {
"Hostname": "bcad5a346f31",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/bundle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"RUBY_MAJOR=2.3",
"RUBY_VERSION=2.3.1",
"RUBY_DOWNLOAD_SHA256=b87c738cb2032bf4920fef8e3864dc5cf8eae9d89d8d523ce0236945c5797dcd",
"RUBYGEMS_VERSION=2.6.3",
"BUNDLER_VERSION=1.11.2",
"GEM_HOME=/usr/local/bundle",
"BUNDLE_PATH=/usr/local/bundle",
"BUNDLE_BIN=/usr/local/bundle/bin",
"BUNDLE_SILENCE_ROOT_WARNING=1",
"BUNDLE_APP_CONFIG=/usr/local/bundle",
"RAILS_VERSION=4.2.6"
],
"Cmd": [
"irb"
],
"Image": "5da847340e289b1357164d7a9f62ac6e67a557c63c4cb2c8823b4cb341776e15",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": [],
"Labels": {}
},
"Architecture": "amd64",
"Os": "linux",
"Size": 54280468,
"VirtualSize": 833718357,
"GraphDriver": {
"Name": "devicemapper",
"Data": {
"DeviceId": "294",
"DeviceName": "docker-253:0-134859501-afdddae9b2bf7469476e271850590aaee2e2c7353121e2801f4c3bd35b30e324",
"DeviceSize": "107374182400"
}
}
}
]
[root@h104 blog2]#