{"id":266164,"date":"2015-09-22T16:04:02","date_gmt":"2015-09-22T12:04:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=266164"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=266164","title":{"rendered":"\u0420\u0435\u0446\u0435\u043f\u0442\u044b Docker: Monkey patch"},"content":{"rendered":"<br \/>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e<\/h4>\n<p>  \u041d\u0430\u0447\u0430\u043b\u043e: <a href=\"http:\/\/habrahabr.ru\/post\/267441\">habrahabr.ru\/post\/267441<\/a><\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e, \u0447\u0442\u043e \u0441\u043b\u0443\u0436\u0431\u0430 docker \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430 \u043d\u0430 \u0442\u043e\u0439 \u0436\u0435 \u043c\u0430\u0448\u0438\u043d\u0435, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0438 \u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0435\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u043a \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u043f\u0430\u043f\u043a\u0435. \u0415\u0449\u0435 \u044f \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044e, \u0447\u0442\u043e \u0432\u044b \u0443\u043c\u0435\u0435\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0441\u0432\u044f\u0437\u043a\u0443 PHP-FPM \u0438 Nginx.<\/p>\n<p>  \u0411\u0435\u0440\u0443 \u043e\u0431\u0440\u0430\u0437\u044b Nginx \u0438 PHP 7.<\/p>\n<pre><code>~$ docker pull nginx ... ~$ docker pull php:7-fpm Status: Downloaded newer image for php:7-fpm <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0447\u0443\u0436\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0434\u043e \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u0432\u043c\u0435\u0441\u0442\u0435 \u0447\u0435\u0440\u0435\u0437 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u0447\u0443\u0436\u043e\u0439 \u043a\u043e\u0434, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, <a href=\"https:\/\/ru.wikipedia.org\/wiki\/Monkey_patch\">monkeypatching<\/a>! \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u044e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b. \u041f\u043e\u043c\u043d\u044e \u043e <a href=\"http:\/\/martinfowler.com\/bliki\/TwoHardThings.html\">\u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/a> \u2014 \u0434\u0430\u044e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u043c \u0432\u0440\u0430\u0437\u0443\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0438\u043c\u0435\u043d\u0430, \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u043d\u0443\u0436\u043d\u044b, \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b \u043c\u043e\u0433\u043b\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<pre><code>~$ docker create --name=php7 php:7-fpm 3d1b737edfcc3f1102fa54c91f9120da4b86d8cbba3092b6f80156c0e31b4d8f ~$ docker create --name=nginx nginx 80be81b27e012fd061ff4b682f0b7b8803500bc38a4b9f787f91661603b2d4b7 <\/code><\/pre>\n<h4>PHP<\/h4>\n<p>  \u041d\u0430\u0447\u043d\u0443 \u0441 PHP \u2014 \u0435\u0433\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u0435\u0435. \u0413\u0434\u0435 \u043b\u0435\u0436\u0430\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0438 \u0434\u043b\u044f PHP \u2014 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 \u0435\u0433\u043e <a href=\"https:\/\/github.com\/docker-library\/php\/blob\/f5e091ac3815dce80ca496298e0cb94638844b10\/7.0\/fpm\/Dockerfile\">Dockerfile<\/a>:  <\/p>\n<pre><code>    ENV PHP_INI_DIR \/usr\/local\/etc\/php        --with-config-file-scan-dir=&quot;$PHP_INI_DIR\/conf.d&quot; \\     WORKDIR \/var\/www\/html     COPY php-fpm.conf \/usr\/local\/etc\/ <\/code><\/pre>\n<p>  \u041a\u043e\u043f\u0438\u0440\u0443\u044e \u0441\u0435\u0431\u0435 \u0438\u0437 \u043a\u043e\u043d\u0442\u0435\u043d\u0435\u0440\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 php  <\/p>\n<pre><code>~$ mkdir monkeypatch ~$ cd monkeypatch\/ $ docker cp php7:\/usr\/local\/etc localetc $ ls localetc\/ pear.conf        php            php-fpm.conf        php-fpm.conf.default    php-fpm.d $ ls localetc\/php conf.d <\/code><\/pre>\n<p>  \u041c\u0435\u0439\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b \u043f\u043e\u043b\u043e\u0436\u0438\u043b\u0438 \u0432 \u043e\u0431\u0440\u0430\u0437 php-fpm.conf, \u043d\u043e \u043d\u0435 \u043f\u043e\u043b\u043e\u0436\u0438\u043b\u0438 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439 php.ini. \u041f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0432\u0437\u044f\u0442\u044c \u0435\u0433\u043e \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 php.  <\/p>\n<pre><code>$ docker cp &quot;$PHP7:\/usr\/src\/php\/php.ini-development&quot; localetc\/php\/php.ini <\/code><\/pre>\n<p>  \u041f\u0440\u0430\u0432\u043b\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0438, \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e. \u0412 \u043a\u0430\u043a\u043e\u0439 \u043f\u0430\u043f\u043a\u0435 PHP \u0438\u0449\u0435\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f? \u0423\u0437\u043d\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432 php, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435.<\/p>\n<pre><code>$ docker run --rm php:7-fpm php -i |grep extension_dir extension_dir =&gt; \/usr\/local\/lib\/php\/extensions\/no-debug-non-zts-20141001 =&gt; \/usr\/local\/lib\/php\/extensions\/no-debug-non-zts-20141001 $ docker run --rm php:7-fpm ls \/usr\/local\/lib\/php\/extensions\/no-debug-non-zts-20141001 opcache.a opcache.so <\/code><\/pre>\n<p>  \u0412 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f\u0445 \u0442\u043e\u043b\u044c\u043a\u043e opcache, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0435\u0433\u043e.  <\/p>\n<pre><code>$ echo extension_dir = &quot;\/usr\/local\/lib\/php\/extensions\/no-debug-non-zts-20141001&quot; &gt;&gt;  localetc\/php\/php.ini $ echo zend_extension = opcache.so &gt;&gt; localetc\/php\/php.ini <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u044e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 php \u0438 \u043c\u043e\u043d\u0442\u0438\u0440\u0443\u044e \u0432 \u043d\u0435\u0433\u043e \u043f\u0430\u043f\u043a\u0443 \u0441 \u043a\u043e\u043d\u0438\u0444\u0433\u0430\u043c\u0438. \u041f\u0443\u0442\u044c \u043a \u043c\u043e\u043d\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u043f\u0430\u043f\u043a\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u0442 \u043a\u043e\u0440\u043d\u044f \u2014 \u0441\u043b\u0443\u0436\u0431\u0430 \u043d\u0435 \u0437\u043d\u0430\u0435\u0442, \u0438\u0437 \u043a\u0430\u043a\u043e\u0439 \u043f\u0430\u043f\u043a\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u043b\u0438\u0435\u043d\u0442 docker.  <\/p>\n<pre><code>$ docker rm php7 php7 $ docker run -v &quot;$(pwd)\/localetc:\/usr\/local\/etc&quot; --name=php7 php:7-fpm php -i |grep Configuration Configuration File (php.ini) Path =&gt; \/usr\/local\/etc\/php Loaded Configuration File =&gt; \/usr\/local\/etc\/php\/php.ini <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 php7 \u0441 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043d\u0430 php. \u0421\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0438 \u043e\u0431\u0440\u0430\u0437\u0430 \u043d\u0435 \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u043b\u0438\u0441\u044c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b php-fpm \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043a\u0430\u043a \u0434\u0435\u043c\u043e\u043d, \u0442\u0430\u043a \u0447\u0442\u043e \u043d\u0430\u0434\u043e \u0441\u0430\u043c\u0438\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0435\u0433\u043e \u0444\u043e\u043d\u043e\u043c, \u043d\u0435 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043a\u0430\u043d\u0430\u043b\u044b \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430.  <\/p>\n<pre><code>$ docker rm php7 $ mkdir scripts $ echo &quot; scripts\/test.php $ docker run -v &quot;$(pwd)\/localetc:\/usr\/local\/etc&quot; \\     -v &quot;$(pwd)\/scripts:\/scripts&quot; \\     --name=php7 php:7-fpm & [29-Aug-2015 15:19:25] NOTICE: fpm is running, pid 1 [29-Aug-2015 15:19:25] NOTICE: ready to handle connections <\/code><\/pre>\n<p>  \u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u044f \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0432\u044b\u0432\u043e\u0434 \u0438\u0437 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 php-fpm \u0432 \u0441\u0432\u043e\u044e \u043a\u043e\u043d\u0441\u043e\u043b\u044c.<\/p>\n<h4>NGINX<\/h4>\n<p>  \u0421 Nginx \u0432\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e. \u041a\u043e\u043f\u0438\u0440\u0443\u044e \u043d\u0430 \u0434\u0438\u0441\u043a \u043f\u0430\u043f\u043a\u0443 \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u0432:  <\/p>\n<pre><code>$ docker cp nginx:\/etc\/nginx . <\/code><\/pre>\n<p>  \u0412 \u043f\u0430\u043f\u043a\u0435 <u>nginx\/<\/u> \u043d\u0430\u0434\u043e \u043e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c nginx.conf, fastcgi_params \u043f\u043e \u0432\u043a\u0443\u0441\u0443, \u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u0430\u0439\u0442\u0430 \u0432 <u>nginx\/conf.d\/<\/u>. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0434\u043b\u044f \u0441\u0432\u044f\u0437\u0438 nginx \u0441 php \u2014 \u044d\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432 \u0438\u043c\u0435\u043d\u0438 \u0445\u043e\u0441\u0442\u0430 \u0438\u043c\u044f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0441 php, \u0430 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b root \u0438 SCRIPT_FILENAME \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u043f\u0443\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 php \u043f\u043e\u0439\u043c\u0451\u0442 \u0432 \u0441\u0432\u043e\u0451\u043c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 php7.  <\/p>\n<pre><code class=\"nginx\">    location ~ \\.php$ {         fastcgi_pass   php7:9000;         fastcgi_param  SCRIPT_FILENAME  \/scripts$fastcgi_script_name; <\/code><\/pre>\n<p>  \u041c\u043e\u043d\u0442\u0438\u0440\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0438 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 nginx \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e \u0441 \u043c\u0430\u043f\u043f\u0438\u043d\u0433\u043e\u043c 80-\u0433\u043e \u043f\u043e\u0440\u0442\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 8080.  <\/p>\n<pre><code>$ docker rm nginx $ docker run -v &quot;$(pwd)\/nginx:\/etc\/nginx&quot; -p 8080:80 --name=nginx nginx & $ curl 127.0.0.1:8080\/test.php 172.17.0.65 -  29\/Aug\/2015:15:50:29 +0000 &quot;GET \/test.php&quot; 200 Hello world! 7.0.0RC1 <\/code><\/pre>\n<p>  Rock&#8217;n&#8217;Roll!<\/p>\n<p>  \u0412 \u0432\u0435\u0440\u0441\u0438\u0438 1.7 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 docker run \u043d\u0430\u0434\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 &#8212;link \u0447\u0442\u043e\u0431\u044b \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 \u0440\u0435\u0437\u043e\u043b\u0432\u0438\u043b\u043e\u0441\u044c \u0438\u043c\u044f \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430. \u0412 \u0432\u0435\u0440\u0441\u0438\u0438 1.8.1 \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u0431\u0435\u0437 \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430.<\/p>\n<h4>\u041b\u043e\u0433\u0438<\/h4>\n<p>  \u041c\u0435\u0439\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b \u043e\u0431\u0440\u0430\u0437\u0430 php \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0435 \u043b\u043e\u0433\u0438 fpm \u0432 \/proc\/self\/fd\/2, \u043e\u043d \u0436\u0435 STDERR \u2014 \u043a\u0430\u043a error_log, \u0442\u0430\u043a \u0438 access.log. \u041e\u0434\u043d\u0430\u043a\u043e, \u043b\u043e\u0433 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0443 \u043c\u0435\u043d\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c nginx, \u0430 \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 php \u043c\u0435\u043d\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0448\u0438\u0431\u043a\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c localetc\/php-fpm.conf \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0435:  <\/p>\n<pre><code>error_log = \/var\/log\/php\/php-fpm.error.log ;access.log = \/proc\/self\/fd\/2  <\/code><\/pre>\n<p>  \u0412 Nginx \u043e\u0431\u043e\u0448\u043b\u0438\u0441\u044c \u0431\u0435\u0437 \u0441\u0430\u043c\u043e\u0434\u0435\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0442\u0430\u043a \u0447\u0442\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u044e access log \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 \u0441\u0430\u0439\u0442\u0430 nginx\/conf.d\/site.ru.conf  <\/p>\n<pre><code>access_log  \/var\/log\/nginx\/host.access.log  main; <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0443 \u0434\u043b\u044f \u043b\u043e\u0433\u043e\u0432 c \u043f\u0440\u0430\u0432\u043e\u043c \u0437\u0430\u043f\u0438\u0441\u0438 \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0430 docker \u0438 \u043f\u043e\u0434\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0435 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b. \u0412 \u044d\u0442\u0443 \u0436\u0435 \u043f\u0430\u043f\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u0432\u044b\u0432\u043e\u0434 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u0442\u0430\u0447\u0438\u0442\u044c:  <\/p>\n<pre><code>$ mkdir log $ sudo chgrp docker log\/ $ sudo chmod g+rwx log\/ $ docker stop nginx php7 $ docker rm nginx php7 $ docker run -d --name=php7 \\     -v &quot;$(pwd)\/localetc:\/usr\/local\/etc&quot; \\     -v &quot;$(pwd)\/scripts:\/scripts&quot; \\     -v &quot;$(pwd)\/log:\/var\/log\/php&quot; \\     php:7-fpm &gt;&gt;log\/docker.php.log 2&gt;&1 $ docker run -d --name=nginx \\     -v &quot;$(pwd)\/nginx:\/etc\/nginx&quot; \\     -v &quot;$(pwd)\/log:\/var\/log\/nginx&quot; \\     -p 8080:80 \\     nginx &gt;&gt;log\/docker.nginx.log 2&gt;&1 $ curl 127.0.0.1:8080\/test.php Hello world! 7.0.0RC1 <\/code><\/pre>\n<p>  \u041a\u043e\u0433\u0434\u0430 \u043d\u0430\u0434\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u2014 \u043c\u043e\u0436\u043d\u043e \u0434\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 php \u0438 nginx.  <\/p>\n<pre><code>$ docker exec php7 pkill -o -USR2 php-fpm $ docker exec nginx service nginx reload Reloading nginx: nginx. <\/code><\/pre>\n<p>  \u041a\u043e\u0433\u0434\u0430 php 7 \u0431\u0443\u0434\u0435\u0442 \u0432\u043a\u043b\u044e\u0447\u0435\u043d \u0432 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432 Debian \u0432 \u043e\u0431\u0440\u0430\u0437\u0435 php:7 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f init-\u0441\u043a\u0440\u0438\u043f\u0442. \u041f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438, \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0437 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u0430 \u043f\u043e \u0432\u044b\u0431\u043e\u0440\u0443.                 <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/267455\/\"> http:\/\/habrahabr.ru\/post\/267455\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<br \/>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e<\/h4>\n<p>  \u041d\u0430\u0447\u0430\u043b\u043e: <a href=\"http:\/\/habrahabr.ru\/post\/267441\">habrahabr.ru\/post\/267441<\/a><\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e, \u0447\u0442\u043e \u0441\u043b\u0443\u0436\u0431\u0430 docker \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430 \u043d\u0430 \u0442\u043e\u0439 \u0436\u0435 \u043c\u0430\u0448\u0438\u043d\u0435, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0438 \u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0435\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u043a \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u043f\u0430\u043f\u043a\u0435. \u0415\u0449\u0435 \u044f \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044e, \u0447\u0442\u043e \u0432\u044b \u0443\u043c\u0435\u0435\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0441\u0432\u044f\u0437\u043a\u0443 PHP-FPM \u0438 Nginx.<\/p>\n<p>  \u0411\u0435\u0440\u0443 \u043e\u0431\u0440\u0430\u0437\u044b Nginx \u0438 PHP 7.<\/p>\n<pre><code>~$ docker pull nginx ... ~$ docker pull php:7-fpm Status: Downloaded newer image for php:7-fpm <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0447\u0443\u0436\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0434\u043e \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u0432\u043c\u0435\u0441\u0442\u0435 \u0447\u0435\u0440\u0435\u0437 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u0447\u0443\u0436\u043e\u0439 \u043a\u043e\u0434, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, <a href=\"https:\/\/ru.wikipedia.org\/wiki\/Monkey_patch\">monkeypatching<\/a>! \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u044e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b. \u041f\u043e\u043c\u043d\u044e \u043e <a href=\"http:\/\/martinfowler.com\/bliki\/TwoHardThings.html\">\u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/a> \u2014 \u0434\u0430\u044e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u043c \u0432\u0440\u0430\u0437\u0443\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0438\u043c\u0435\u043d\u0430, \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u043d\u0443\u0436\u043d\u044b, \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b \u043c\u043e\u0433\u043b\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-266164","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/266164","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=266164"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/266164\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=266164"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=266164"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=266164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}