{"id":164,"date":"2015-04-23T16:55:25","date_gmt":"2015-04-23T07:55:25","guid":{"rendered":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2015\/04\/23\/docker-tips"},"modified":"2015-04-23T16:55:25","modified_gmt":"2015-04-23T07:55:25","slug":"docker-tips","status":"publish","type":"post","link":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2015\/04\/23\/docker-tips\/","title":{"rendered":"Docker \u3092\u4f7f\u3063\u3066\u958b\u767a\u3057\u3066\u307f\u3066\u308f\u304b\u3063\u305f\u3053\u3068"},"content":{"rendered":"
<\/p>\n
Ruby on Rails \u306e\u958b\u767a\u306b\u3001Docker \u3092\u4f7f\u7528\u3057\u3066\u307f\u3066\u308f\u304b\u3063\u305f\u3053\u30682\u70b9\u3068\u305d\u306e\u5bfe\u51e6\u65b9\u6cd5\u3092\u307e\u3068\u3081\u3066\u307f\u305f\u3002<\/p>\n
Mac \u3067 Docker \u3092\u4f7f\u7528\u3057\u305f\u3044\u5834\u5408\u306f\u3001boot2docker \u3092\u4f7f\u308f\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u3002
boot2docker \u306f\u3001Docker\u30b3\u30f3\u30c6\u30ca\u3092\u52d5\u4f5c\u3055\u305b\u308b\u3053\u3068\u3092\u76ee\u7684\u306b\u4f5c\u3089\u308c\u305f\u8efd\u91cf\u306a Linux \u30c7\u30a3\u30b9\u30c8\u30ea\u30d3\u30e5\u30fc\u30b7\u30e7\u30f3\u3067\u3042\u308a\u3001VirtualBox \u3092\u4f7f\u3046\u3053\u3068\u3067\u3001Linux \u4ee5\u5916\u306e\u74b0\u5883\u3067\u3082\u7c21\u5358\u306b Docker \u3092\u5229\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u308b\u3002
boot2docker \u306f\u3001\u5171\u6709\u30d5\u30a9\u30eb\u30c0\u3068\u3057\u3066\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f VirtualBox \u306e VirtualBox folder sharing \u3092\u4f7f\u7528\u3059\u308b\u3002
VirtualBox SharedFolders (vboxsf) \u3067\u3082\u30d5\u30a1\u30a4\u30eb\u6570\u304c\u5c11\u306a\u3044\u3046\u3061\u306f\u305d\u308c\u307b\u3069\u6c17\u306b\u306a\u3089\u306a\u3044\u304c\u3001\u30d5\u30a1\u30a4\u30eb\u6570\u304c\u591a\u304f\u306a\u3063\u3066\u304f\u308b\u3068\u975e\u5e38\u306b\u9045\u304f\u611f\u3058\u305f\u3002<\/p>\n
\u3053\u308c\u306b\u3064\u3044\u3066\u306f\u3001boot2docker \u306e issues \u3068\u3057\u3066\u4e0a\u304c\u3063\u3066\u3044\u3066\u3001\u69d8\u3005\u306a\u8b70\u8ad6\u304c\u5c55\u958b\u3055\u308c\u3066\u3044\u308b\u3088\u3046\u3067\u3042\u308b\u3002<\/p>\n
nfs share \/ guest to host \u00b7 Issue #64 \u00b7 boot2docker\/boot2docker<\/a> \u5bfe\u5fdc\u65b9\u6cd5\u306b\u95a2\u3057\u3066\u306f\u3044\u304f\u3064\u304b\u3042\u308b\u3088\u3046\u3060\u304c\u3001vboxsf \u3067\u306f\u306a\u304f\u3066\u3001NFS \u3092\u5229\u7528\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u516c\u958b\u3057\u3066\u3044\u308b\u4eba\u304c\u3044\u305f\u306e\u3067\u305d\u308c\u3092\u4f7f\u3063\u3066\u307f\u305f\u3002<\/p>\n \u5143\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u306f\u3053\u3061\u3089\u3002 \u305d\u306e\u307e\u307e\u4f7f\u3063\u3066\u307f\u305f\u3089\u3001\u4e0b\u8a18\u306e\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u3046\u307e\u304f\u3044\u304b\u306a\u304b\u3063\u305f\u306e\u3067\u3001<\/p>\n \u30db\u30b9\u30c8OS\u306eIP\u30a2\u30c9\u30ec\u30b9\u3092\u53d6\u5f97\u3059\u308b\u90e8\u5206(30\u884c\u76ee\u3042\u305f\u308a)\u3068\u3001 \u5b9f\u884c\u65b9\u6cd5\u306b\u3064\u3044\u3066\u306f\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u5185\u306b\u66f8\u304b\u308c\u3066\u3044\u308b\u901a\u308a\u3001\u4e0b\u8a18\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3060\u3051\u3002 \u3053\u306e\u5bfe\u5fdc\u3067\u3001vboxsf \u3088\u308a\u306f\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306b\u3064\u3044\u3066\u4f53\u611f\u7684\u306b\u306f\u304b\u306a\u308a\u6539\u5584\u3067\u304d\u305f\u3002<\/p>\n Docker \u3067\u958b\u767a\u3092\u3057\u3066\u3044\u305f\u3089\u3001 \u306f\u3058\u3081\u306f\u3001\u5404\u81ea\u304c\u305d\u308c\u305e\u308c\u306e\u7aef\u672b\u3067\u3001Docker Hub\u4e0a\u306e\u30aa\u30d5\u30a3\u30b7\u30e3\u30eb\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u306e \u3058\u3083\u3042\u3001\u30d3\u30eb\u30c9\u6e08\u307f\u306e\u30a4\u30e1\u30fc\u30b8\u3092 Docker Hub \u306b\u4e0a\u3052\u3066\u7f6e\u3044\u3066\u3001\u305d\u308c\u3092\u57fa\u306b\u5404\u81ea\u304c\u958b\u767a\u3092\u3059\u308b\u3001\u3068\u3044\u3046\u904b\u7528\u306b\u3057\u3066\u307f\u3088\u3046\u3001\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u3063\u305f\u3002 \u305d\u3046\u3044\u3063\u305f\u904b\u7528\u3092\u7d9a\u3051\u3066\u3044\u305f\u3089\u3001 Docker Documentation<\/a> \u306b\u3088\u308b\u3068\u3001Docker \u3067\u306f Union File System \u3068\u3044\u3046\u3082\u306e\u304c\u4f7f\u308f\u308c\u3066\u304a\u308a\u3001\u4e0b\u8a18\u306e\u753b\u50cf\u306e\u3088\u3046\u306b\u3001\u5909\u66f4\u3092\u52a0\u3048\u308b\u3054\u3068\u306b\u4f55\u5c64\u3082 read-only \u306e\u5c64\u3092\u91cd\u306d\u3066\u3044\u304d\u3001\u6700\u4e0a\u4f4d\u306e\u5c64\u306e\u307f read-write \u306b\u3059\u308b\u3001\u3068\u3044\u3046\u3053\u3068\u3092\u884c\u3046\u3002<\/p>\n <\/p>\n Docker \u3067\u306f\u3001127 \u4ee5\u4e0a\u306e\u30ec\u30a4\u30e4\u30fc\u3092\u91cd\u306d\u308b\u3053\u3068\u304c\u3067\u304d\u306a\u3044\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u308b\u3002 Increase max image depth to 127 by crosbymichael \u00b7 Pull Request #2897 \u00b7 docker\/docker<\/a><\/p>\n \u3067\u306f\u3001\u3069\u306e\u3088\u3046\u306a\u5bfe\u5fdc\u3092\u3059\u308c\u3070\u3053\u306e\u5236\u9650\u306b\u5f15\u3063\u304b\u304b\u3089\u306a\u3044\u306e\u304b\u3001\u8abf\u3079\u3066\u307f\u305f\u3002 Docker \u3067\u306f\u3001Dockerfile \u306b\u8a18\u8ff0\u3057\u3066\u3044\u308b \u3053\u308c\u3092\u4e0b\u8a18\u306e\u3088\u3046\u306b\u3001 \u3082\u3057\u304f\u306f\u3001\u30b3\u30de\u30f3\u30c9\u3092\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u306b\u307e\u3068\u3081\u3066\u5b9f\u884c\u3059\u308b\u3002<\/p>\n \u3068\u3044\u3046\u5177\u5408\u306b\u3002<\/p>\n \u3082\u3046\u4e00\u3064\u306e\u5bfe\u5fdc\u65b9\u6cd5\u3068\u3057\u3066\u3001 \u3010docker export\u3011<\/p>\n \u3010docker import\u3011<\/p>\n \u305f\u3060\u3001\u6c17\u3092\u3064\u3051\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u306e\u304c\u3001export\/import \u3092\u3059\u308b\u3068\u3001\u5c65\u6b74\u60c5\u5831\u304c\u6d88\u3048\u3066\u3057\u307e\u3046\u305f\u3081\u3001\u74b0\u5883\u5909\u6570\u306a\u3069\u306e\u8a2d\u5b9a\u304c\u6d88\u3048\u3066\u3057\u307e\u3046\u3068\u3044\u3046\u3053\u3068\u3060\u3002 \u3068\u8a2d\u5b9a\u3057\u305f TESTENV \u3068\u3044\u3046\u74b0\u5883\u5909\u6570\u304c\u3001<\/p>\n \u6d88\u3048\u3066\u3057\u307e\u3046\u3002<\/p>\n \u305d\u306e\u305f\u3081\u3001\u74b0\u5883\u5909\u6570\u304c\u5fc5\u8981\u306a\u5834\u5408\u306f\u3001export\/import \u3092\u884c\u3063\u305f\u30a4\u30e1\u30fc\u30b8\u3092\u57fa\u306b\u518d\u5ea6 Dockerfile \u3067\u5b9a\u7fa9\u3057\u3066\u30d3\u30eb\u30c9\u3057\u3066\u3084\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002 \u4eca\u56de\u306f\u3001Docker \u3092\u4f7f\u3063\u3066\u307f\u3066\u6c17\u306b\u306a\u3063\u305f\u3053\u3068\u3001\u30a8\u30e9\u30fc\u3068\u305d\u306e\u5bfe\u5fdc\u306b\u3064\u3044\u3066\u3001\u307e\u3068\u3081\u3066\u307f\u305f\u3002 \u2026\u305d\u306e\u3042\u305f\u308a\u3082\u3053\u3053\u3067\u307e\u3068\u3081\u305f\u304b\u3063\u305f\u3051\u3069\u3001\u307e\u3060\u3061\u3087\u3063\u3068\u6642\u9593\u304c\u304b\u304b\u308a\u305d\u3046\u306a\u306e\u3067\u3001\u4eca\u56de\u306f\u5272\u611b\u3002 <\/p>\n Docker\u3092\u6d3b\u7528\u3057\u305f\u30b5\u30fc\u30d3\u30b9\u958b\u767a<\/a>\u3092\u5fa1\u5e0c\u671b\u306e\u4f01\u696d\u69d8\u306f\u3001\u662f\u975eMMM\u306b\u3054\u76f8\u8ac7\u4e0b\u3055\u3044\u307e\u305b\uff01<\/p>\n Optimizing Docker Images | Century Link Labs<\/a> Ruby on Rails \u306e\u958b\u767a\u306b\u3001Docker \u3092\u4f7f\u7528\u3057\u3066\u307f\u3066\u308f\u304b\u3063\u305f\u3053\u30682\u70b9\u3068\u305d\u306e\u5bfe\u51e6\u65b9\u6cd5\u3092\u307e\u3068\u3081\u3066\u307f\u305f\u3002 boot2docker \u3060\u3068\u30d5\u30a1\u30a4\u30eb\u6570\u304c\u591a\u304f\u306a\u308b\u3068\u975e\u5e38\u306b\u9045\u304f\u306a\u3063\u305f Aufs \u306e\u30ec\u30a4\u30e4\u30fc\u6570\u5236\u9650\u3067\u30a8\u30e9\u30fc\u304c\u51fa\u305f boot2docker \u3060\u3068\u30d5\u30a1\u30a4\u30eb\u6570\u304c\u591a\u304f\u306a\u308b\u3068\u975e\u5e38\u306b\u9045\u304f\u306a\u3063\u305f Mac \u3067 Docker \u3092\u4f7f\u7528\u3057\u305f\u3044\u5834\u5408\u306f\u3001boot2docker \u3092\u4f7f\u308f\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u3002boot2doc […]<\/p>\n","protected":false},"author":3,"featured_media":826,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[73],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/164"}],"collection":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/comments?post=164"}],"version-history":[{"count":0,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/164\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media\/826"}],"wp:attachment":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media?parent=164"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/categories?post=164"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/tags?post=164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
Volume sharing performance issues \u00b7 Issue #593 \u00b7 boot2docker\/boot2docker<\/a><\/p>\n
Script to mount \/Users with nfs instead of vboxsf in boot2docker<\/a><\/p>\nmount: RPC: Authentication error; why = Client credential too weak<\/code><\/pre>\n
\/etc\/exports<\/code>\u306b\u8a18\u8ff0\u3059\u308b\u5185\u5bb9(44\u884c\u76ee\u3042\u305f\u308a)\u3092\u3059\u3053\u3057\u5909\u66f4\u3057\u3066\u3044\u308b\u3002<\/p>\n
#!\/bin\/bash\n\n#\n# This script will mount \/Users in the boot2docker VM using NFS (instead of the\n# default vboxsf). It's probably not a good idea to run it while there are\n# Docker containers running in boot2docker.\n#\n# Usage: sudo .\/boot2docker-use-nfs.sh\n#\n\nif [ "$USER" != "root" ]\nthen\n echo "This script must be run with sudo: sudo ${0}"\n exit -1\nfi\n\n# Run command as non root http:\/\/stackoverflow.com\/a\/10220200\/96855\nB2D_IP=$(sudo -u ${SUDO_USER} boot2docker ip &> \/dev\/null)\n\nif [ "$?" != "0" ]\nthen\n sudo -u ${SUDO_USER} boot2docker up\n $(sudo -u ${SUDO_USER} boot2docker shellinit)\n B2D_IP=$(sudo -u ${SUDO_USER} boot2docker ip &> \/dev\/null)\n #echo "You need to start boot2docker first: boot2docker up && $(boot2docker shellinit) "\n #exit -1\nfi\n\n#OSX_IP=$(ifconfig en0 | grep --word-regexp inet | awk '{print $2}')\nVBOXNET=$(sudo -u ${SUDO_USER} VBoxManage showvminfo boot2docker-vm --machinereadable | grep hostonlyadapter | cut -d '"' -f 2)\nOSX_IP=$(ifconfig $VBOXNET | grep --word-regexp inet | awk '{print $2}')\nMAP_USER=${SUDO_USER}\nMAP_GROUP=$(sudo -u ${SUDO_USER} id -n -g)\n\n# Backup exports file\n$(cp -n \/etc\/exports \/etc\/exports.bak) && \n echo "Backed up \/etc\/exports to \/etc\/exports.bak"\n\n# Delete previously generated line if it exists\ngrep -v '^\/Users ' \/etc\/exports > \/etc\/exports\n\n# We are using the OS X IP because the b2d VM is behind NAT\n# echo "\/Users -mapall=${MAP_USER}:${MAP_GROUP} ${OSX_IP}" \necho "\/Users -mapall=${MAP_USER}:${MAP_GROUP} --alldirs" \n >> \/etc\/exports\n\nnfsd restart\n\nsudo -u ${SUDO_USER} boot2docker ssh << EOF\n echo "Unmounting \/Users"\n sudo umount \/Users 2> \/dev\/null\n echo "Restarting nfs-client"\n sudo \/usr\/local\/etc\/init.d\/nfs-client restart 2> \/dev\/null\n echo "Waiting 10s for nfsd and nfs-client to restart."\n sleep 10\n echo "Mounting \/Users"\n sudo mount $OSX_IP:\/Users \/Users -o rw,async,noatime,rsize=32768,wsize=32768,proto=tcp,nfsvers=3\n echo "Mounted \/Users:"\n ls -al \/Users\n exit\nEOF<\/code><\/pre>\n
\nboot2docker \u304c\u8d77\u52d5\u3057\u3066\u3044\u306a\u3051\u308c\u3070\u8d77\u52d5\u3082\u3057\u3066\u304f\u308c\u308b\u3002<\/p>\n$ sudo .\/boot2docker-use-nfs.sh<\/code><\/pre>\n
\nAufs \u306e\u30ec\u30a4\u30e4\u30fc\u6570\u5236\u9650\u3067\u30a8\u30e9\u30fc\u304c\u51fa\u305f<\/h2>\n
Cannot create container with more than 127 parents<\/code>\u3068\u3044\u3046\u30a8\u30e9\u30fc\u304c\u51fa\u305f\u3002
\u3053\u308c\u306f\u3001Aufs \u306e\u30ec\u30a4\u30e4\u30fc\u6570\u5236\u9650\u306b\u3088\u308b\u3082\u306e\u3089\u3057\u3044\u3002<\/p>\n\u30a8\u30e9\u30fc\u304c\u51fa\u305f\u80cc\u666f\u3068\u3057\u3066<\/h3>\n
rails<\/code>\u306e\u30a4\u30e1\u30fc\u30b8<\/a>\u3092\u30d9\u30fc\u30b9\u306b\u3057\u3066\u3001
docker build<\/code>\u3092\u3057\u3066\u958b\u767a\u3092\u884c\u3063\u3066\u3044\u305f\u3002
\u305f\u3060\u3001\u305d\u308c\u3060\u3068\u30d3\u30eb\u30c9\u3059\u308b\u306e\u306b\u6642\u9593\u304c\u304b\u304b\u308b\u3001\u3068\u3044\u3046\u4e0d\u6e80\u70b9\u304c\u51fa\u3066\u304d\u305f\u3002<\/p>\n
\u4f55\u304b\u5909\u66f4\u304c\u3042\u308c\u3070\u3001Docker Hub \u306b\u4e0a\u304c\u3063\u3066\u3044\u308b\u30a4\u30e1\u30fc\u30b8\u306b\u8ffd\u52a0\u3067\u5909\u66f4\u3092\u52a0\u3048\u305f\u4e0a\u3067\u3001\u305d\u306e\u30a4\u30e1\u30fc\u30b8\u3092\u518d\u5ea6 Docker Hub \u306b\u4e0a\u3052\u3066\u5171\u6709\u3059\u308b\u3002<\/p>\nCannot create container with more than 127 parents<\/code> \u3068\u3044\u3046\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u3057\u307e\u3063\u305f\u306e\u3060\u3002
Docker Hub \u3067\u30d3\u30eb\u30c9\u6e08\u307f\u306e\u30a4\u30e1\u30fc\u30b8\u3092\u3001\u958b\u767a\u30e1\u30f3\u30d0\u30fc\u9593\u3067\u5171\u6709\u3057\u59cb\u3081\u305f\u3053\u3068\u3067\u3053\u306e\u5236\u9650\u306b\u6c17\u3065\u3044\u305f\u306e\u3067\u3042\u308b\u3002<\/p>\nDocker \u306e\u30ec\u30a4\u30e4\u30fc\u6570\u5236\u9650<\/h3>\n
\n\uff08\u3082\u3068\u3082\u3068 42 \u3060\u3063\u305f\u3088\u3046\u3060\u3002\u305d\u308c\u304c\u4eca\u306f\u3001127 \u307e\u3067\u62e1\u5f35\u3055\u308c\u3066\u3044\u308b\uff09<\/p>\n\u5bfe\u51e6\u65b9\u6cd5<\/h3>\n
\u4e3b\u306a\u5bfe\u5fdc\u3068\u3057\u3066\u3001\u4e0b\u8a18\u306e2\u3064\u3042\u308b\u3002<\/p>\n\n
RUN<\/code> \u306a\u3069\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u56de\u6570\u3092\u6e1b\u3089\u3059<\/li>\n
Dockerfile \u306e
RUN<\/code> \u306a\u3069\u3067\u5b9f\u884c\u3059\u308b\u56de\u6570\u3092\u6e1b\u3089\u3059<\/h4>\n
RUN<\/code> \u3084
ADD<\/code> \u306a\u3069\u304c\u5b9f\u884c\u3055\u308c\u308b\u305f\u3073\u306b\u3001\u30ec\u30a4\u30e4\u30fc\u304c\u91cd\u306a\u308b\u3053\u3068\u306b\u306a\u308b\u3002
\u305d\u3053\u3067\u3001\u30b3\u30de\u30f3\u30c9\u3092 &&<\/code> \u3067\u3064\u306a\u3044\u3067\u5b9f\u884c\u3059\u308b\u56de\u6570\u3092\u6e1b\u3089\u3059\u3002
\u4f8b\u3048\u3070\u4e0b\u8a18\u306e\u3088\u3046\u306a Dockerfile \u304c\u3042\u3063\u305f\u3068\u3059\u308b\u3002<\/p>\nFROM debian:wheezy\nWORKDIR \/tmp\n\nRUN wget -nv http:\/\/www.example.com\/foo\/someutility-v1.0.0.tar.gz\nRUN tar -xvf someutility-v1.0.0.tar.gz\nRUN mv \/tmp\/someutility-v1.0.0\/someutil \/usr\/bin\/someutil\nRUN rm -rf \/tmp\/someutility-v1.0.0\nRUN rm \/tmp\/someutility-v1.0.0.tar.gz<\/code><\/pre>\n
&&<\/code> \u3067\u3064\u306a\u3052\u308b\u3053\u3068\u3067\u3001\u30ec\u30a4\u30e4\u30fc\u6570\u3092\u304b\u305b\u3052\u308b\u3068\u306e\u3053\u3068\u3002<\/p>\n
FROM debian:wheezy\nWORKDIR \/tmp\n\nRUN wget -nv http:\/\/www.example.com\/foo\/someutility-v1.0.0.tar.gz &&\ntar -xvf someutility-v1.0.0.tar.gz &&\nmv \/tmp\/someutility-v1.0.0\/someutil \/usr\/bin\/someutil &&\nrm -rf \/tmp\/someutility-v1.0.0 &&\nrm \/tmp\/someutility-v1.0.0.tar.gz<\/code><\/pre>\n
FROM debian:wheezy\nWORKDIR \/tmp\n\nRUN script.sh<\/code><\/pre>\n
export & import \u3092\u5b9f\u884c\u3059\u308b<\/h4>\n
docker export\/import<\/code> \u3092\u4f7f\u3046\u65b9\u6cd5\u304c\u3042\u308b\u3002
docker export<\/code> \u3092\u3059\u308b\u3068\u3001\u3059\u3079\u3066\u306e\u30d5\u30a1\u30a4\u30eb\u30b7\u30b9\u30c6\u30e0\u306e\u5dee\u5206\u306e\u5c65\u6b74\u60c5\u5831\u3092\u4fdd\u6301\u305b\u305a\u306b\u3001\u30d5\u30a1\u30a4\u30eb\u306b\u51fa\u529b\u3059\u308b\u3002
\u305d\u306e\u305f\u3081\u3001\u5c65\u6b74\u60c5\u5831\u3067\u3042\u308b\u30ec\u30a4\u30e4\u30fc\u3092\u7bc0\u7d04\u3067\u304d\u308b\u306e\u3067\u3042\u308b\u3002
\n\u4e0b\u8a18\u306e\u3088\u3046\u306b\u5b9f\u884c\u3059\u308c\u3070 docker export\/import<\/code> \u304c\u3067\u304d\u308b\u3002<\/p>\n
$ sudo docker export $container_id > tmp.tar<\/code><\/pre>\n
$ cat tmp.tar | sudo docker import - <REPOS:TAG><\/code><\/pre>\n
\n\u4f8b\u3048\u3070 Dockerfile \u3067\u3001<\/p>\nENV TESTENV aaabbbccc<\/code><\/pre>\n
$ docker run -it test env\nPATH=\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin\nHOSTNAME=d3e4c37dbfa6\nTERM=xterm\nTESTENV=aaabbbccc #\u3053\u306e\u74b0\u5883\u5909\u6570\u3092\u8a2d\u5b9a\nHOME=\/root<\/code><\/pre>\n
docker export\/import<\/code> \u3092\u884c\u3046\u3053\u3068\u3067\u3001<\/p>\n
$ docker export d3e4c37dbfa6 > testenv.tar\n$ cat testenv.tar | docker import - mmmsasaki\/aufstest:testenv\n4d4399606c802c31035eb79b729d3ff99d63edfe08916c5b8312b3bc5619f752<\/code><\/pre>\n
$ docker run -ti mmmsasaki\/aufstest:testenv env\nPATH=\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin\nHOSTNAME=094e28fe25e9\nTERM=xterm\nHOME=\/root<\/code><\/pre>\n
\u307e\u305f\u3001\u74b0\u5883\u5909\u6570\u3060\u3051\u3067\u306a\u304f\u3001Dockerfile \u3067\u8a2d\u5b9a\u3057\u3066\u3044\u308b\u3001CMD<\/code> \u3084
EXPOSE<\/code> \u306a\u3069\u3082\u4fdd\u6301\u3057\u3066\u3044\u306a\u3044\u306e\u3067\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3042\u308b\u3002 <\/p>\n
docker import<\/code> \u3092\u884c\u3046\u969b\u306b\u3001\u74b0\u5883\u5909\u6570\u3092\u8a2d\u5b9a\u3057\u305f\u3044\u5834\u5408\u306f\u3001
--change "ENV DEBUG true"<\/code> \u3068\u3044\u3046\u3088\u3046\u306b\u30b3\u30de\u30f3\u30c9\u3067\u6e21\u3057\u3066\u3084\u308b\u3068\u8a2d\u5b9a\u304c\u53ef\u80fd\u3002
\n\u524d\u8ff0\u306e\u4f8b\u3067\u8a00\u3046\u3068\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b\u306a\u308b\u3002<\/p>\n$ cat testenv.tar | docker import --change "ENV TESTENV aabbcc" - mmmsasaki\/aufstest:testenv<\/code><\/pre>\n
\u307e\u3068\u3081<\/h2>\n
export\/import \u306e\u904b\u7528\u306b\u3064\u3044\u3066\u306f\u3001\u958b\u767a\u30e1\u30f3\u30d0\u30fc\u304c\u3082\u3063\u3068\u7c21\u5358\u306b\u5404\u81ea\u3067\u884c\u3048\u308b\u3088\u3046\u306b\u30b9\u30af\u30ea\u30d7\u30c8\u5316\u3057\u305f\u3044\u3068\u601d\u3063\u3066\u3044\u308b\u3002
\u305d\u306e\u65b9\u304c\u697d\u3060\u3057\u3001\u4f55\u3088\u308a\u30df\u30b9\u304c\u306a\u3044\u304b\u3089\u3002<\/p>\n\u53c2\u8003URL<\/h3>\n
Docker\u30a4\u30e1\u30fc\u30b8\u306e\u6700\u9069\u5316 - \u30ef\u30b6\u30ce\u30d0 | wazanova<\/a>
\u6c17\u3065\u3044\u305f\u3089\u30ac\u30b8\u30a7\u7363: docker export\u3068docker import\u3067docker\u30a4\u30e1\u30fc\u30b8\u306e\u30b5\u30a4\u30ba\u3092\u5c0f\u3055\u304f\u3059\u308b<\/a>
Dockerfile \u306e 127 \u884c\u5236\u9650\u3092\u8a66\u3057\u305f - \u3088\u3046\u3078\u3044\u306e\u65e5\u3005\u7cbe\u9032 XP<\/a>
Docker \u7ba1\u7406\u30b3\u30de\u30f3\u30c9 - @\/\/\u30e1\u30e2<\/a>
\u79c1\u306e Docker TIPS - Qiita<\/a>
\u7b2c3\u56de \u30b3\u30f3\u30c6\u30ca\u578b\u4eee\u60f3\u5316\u306e\u60c5\u5831\u4ea4\u63db\u4f1a\uff20\u5927\u962a (\u30b3\u30f3\u30c6\u30ca\u578bVM\u3084\u95a2\u9023\u3059\u308b\u30ab\u30fc\u30cd\u30eb\u7b49\u306e\u6280\u8853\u304c\u8a71\u984c\u306e\u52c9\u5f37\u4f1a)\u306b\u53c2\u52a0\u3057\u305f - @znz blog<\/a>
Docker command line - Docker Documentation<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"