{"id":297,"date":"2019-05-30T18:04:19","date_gmt":"2019-05-30T15:04:19","guid":{"rendered":"https:\/\/itbru.ru\/?p=297"},"modified":"2019-05-30T18:05:11","modified_gmt":"2019-05-30T15:05:11","slug":"docker-migrate","status":"publish","type":"post","link":"https:\/\/itbru.ru\/index.php\/2019\/05\/30\/docker-migrate\/","title":{"rendered":"Docker. \u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u043e\u0431\u0440\u0430\u0437\u0430 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u0445\u043e\u0441\u0442."},"content":{"rendered":"\n<p>\u0418\u043c\u0435\u0435\u043c docker \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u0445\u043e\u0441\u0442. \u041f\u043e \u0441\u0443\u0442\u0438 \u043d\u0430\u0448\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0443 \u043e\u0431\u0440\u0430\u0437\u0430 \u043d\u0430 \u043d\u043e\u0432\u044b\u0439 \u0445\u043e\u0441\u0442 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0443 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>\u0421\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>user@host:\/# docker ps\nCONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                           NAMES\n262202e83aeb        priv\/container      \"bash\"              2 hours ago         Up 2 hours          80\/tcp, 0.0.0.0:443-&gt;443\/tcp   ACME\n<\/code><\/pre>\n\n\n\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u0430\u043a\u0438\u0435 \u0442\u043e\u043c\u0430 \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u044b \u043a \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0443 \u043c\u043e\u0436\u043d\u043e \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 &#171;Mounts&#187; \u0432 \u0432\u044b\u0432\u043e\u0434\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker inspect %ID_\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430%<\/code><\/pre>\n\n\n\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0437\u0430. \u041d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043a\u0443\u0434\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c, \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u0447\u0442\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker save -o \/%\u043f\u0443\u0442\u044c%\/image.tar priv\/container<\/code><\/pre>\n\n\n\n<p>\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0442\u043e\u043c\u0430(volumes). \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043b\u0435\u0436\u0430\u0442 &#171;\/var\/lib\/docker\/volumes\/&#187;. \u041d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043a\u0443\u0434\u0430 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u0447\u0442\u043e:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> tar -cvf .\/data_vol.tar \/var\/lib\/docker\/volumes\/data_vol\/<\/code><\/pre>\n\n\n\n<p>\u041f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c \u043e\u0431\u0440\u0430\u0437 \u0438 \u0442\u043e\u043c\u0430 \u043d\u0430 \u043d\u043e\u0432\u044b\u0439 \u0445\u043e\u0441\u0442, \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 &#171;scp&#187;. \u0415\u0441\u043b\u0438 \u043f\u043e\u0440\u0442 SSH \u043d\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439, \u043d\u0443\u0436\u043d\u043e \u0435\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043b\u044e\u0447\u043e\u043c &#171;-P&#187;. \u041a\u043b\u044e\u0447 &#171;-P&#187; \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u043c\u0435\u0441\u0442\u0435. \u0414\u0430\u043b\u0435\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0447\u0442\u043e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043f\u043e\u0442\u043e\u043c \u0445\u043e\u0441\u0442 \u043a\u0443\u0434\u0430 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 %\u0438\u043c\u044f_\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f%@%\u0430\u0434\u0440\u0435\u0441_\u0445\u043e\u0441\u0442\u0430%:%\u043f\u0443\u0442\u044c_\u043a\u0443\u0434\u0430_\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c%. \u041f\u0440\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0438 &#171;~&#187; \u0432 \u043f\u0443\u0442\u0438 \u0444\u0430\u0439\u043b \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u0434\u043e\u043c\u0430\u0448\u043d\u044e\u044e \u043f\u0430\u043f\u043a\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>scp -P 123 .\/image.tar user@123.123.123.2:~<\/code><\/pre>\n\n\n\n<p>\u041f\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u043e\u043c\u0430 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0437\u0430\u043a\u0438\u043d\u0443\u0442\u044c \u043d\u0430 \u043c\u0435\u0441\u0442\u043e(\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e &#171;\/var\/lib\/docker\/volumes\/&#187;):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tar -xvf \/home\/user\/data_vol.tar<\/code><\/pre>\n\n\n\n<p>\u041a\u043e\u0440\u043c\u0438\u043c \u0434\u043e\u043a\u0435\u0440 \u043d\u0430\u0448\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker load -i \/home\/user\/image.tar<\/code><\/pre>\n\n\n\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u0441\u0435\u0445 \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440 \u0434\u043e\u043a\u0435\u0440 \u0443\u0432\u0438\u0434\u0438\u0442 \u043e\u0431\u0440\u0430\u0437 \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u0437 \u043d\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0418\u043c\u0435\u0435\u043c docker \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u0445\u043e\u0441\u0442. \u041f\u043e \u0441\u0443\u0442\u0438 \u043d\u0430\u0448\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0443 \u043e\u0431\u0440\u0430\u0437\u0430 \u043d\u0430 \u043d\u043e\u0432\u044b\u0439 \u0445\u043e\u0441\u0442 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0443 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-297","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/itbru.ru\/index.php\/wp-json\/wp\/v2\/posts\/297","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itbru.ru\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itbru.ru\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itbru.ru\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/itbru.ru\/index.php\/wp-json\/wp\/v2\/comments?post=297"}],"version-history":[{"count":1,"href":"https:\/\/itbru.ru\/index.php\/wp-json\/wp\/v2\/posts\/297\/revisions"}],"predecessor-version":[{"id":298,"href":"https:\/\/itbru.ru\/index.php\/wp-json\/wp\/v2\/posts\/297\/revisions\/298"}],"wp:attachment":[{"href":"https:\/\/itbru.ru\/index.php\/wp-json\/wp\/v2\/media?parent=297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itbru.ru\/index.php\/wp-json\/wp\/v2\/categories?post=297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itbru.ru\/index.php\/wp-json\/wp\/v2\/tags?post=297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}