{"id":259356,"date":"2015-06-15T17:37:02","date_gmt":"2015-06-15T13:37:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=259356"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=259356","title":{"rendered":"Docker. Best practices \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043e\u0431\u0440\u0430\u0437\u0430 Oracle xe 11g"},"content":{"rendered":"<p>     \t<img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/f99\/773\/96f\/f9977396f04e4f328bf13b56420ff70f.jpg\"\/><\/p>\n<p>  Docker \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0441\u0442\u0430\u043b \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u0435\u043d \u0437\u0430 \u0441\u0447\u0435\u0442 \u0441\u0432\u043e\u0435\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u0438 \u0438, \u0433\u043b\u0430\u0432\u043d\u043e\u0435, \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b.<\/p>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0442\u044b\u0441\u044f\u0447\u0438 \u043e\u0431\u0440\u0430\u0437\u043e\u0432 \u0432 <a href=\"http:\/\/hub.docker.com\">hub.docker.com<\/a>. \u0417\u0430 \u0441\u0447\u0435\u0442 \u0441\u0432\u043e\u0435\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043e\u0431\u0440\u0430\u0437\u043e\u0432, \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u0437\u0430 \u043f\u043e\u043b \u0447\u0430\u0441\u0430 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u0432\u043d\u043e\u0441\u0438\u0442\u044c \u0441\u0432\u043e\u0439 \u0432\u043a\u043b\u0430\u0434.<\/p>\n<p>  \u041d\u043e \u043c\u043d\u043e\u0433\u0438\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u044e\u0442 \u043e <a href=\"https:\/\/docs.docker.com\/articles\/dockerfile_best-practices\/\">best practices<\/a>, \u0438 \u0437\u0430 \u0441\u0447\u0435\u0442 \u044d\u0442\u043e\u0433\u043e docker hub \u043d\u0430\u043f\u043e\u043b\u043d\u0438\u043b\u0441\u044f \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043d\u0435 \u0441\u0430\u043c\u044b\u0445 \u043b\u0443\u0447\u0448\u0438\u0445 \u043e\u0431\u0440\u0430\u0437\u043e\u0432.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0447\u0443 \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0437\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Best Practices \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u044f \u0432\u044b\u0431\u0440\u0430\u043b \u043d\u0435 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0437 \u0441 <b>oracle 11g xe<\/b> <a href=\"https:\/\/github.com\/MaksymBilenko\/docker-oracle-xe-11g\">GitHub<\/a> <a href=\"https:\/\/registry.hub.docker.com\/u\/sath89\/oracle-xe-11g\/\">docker-hub<\/a>.<\/p>\n<p>  \u0412 <a href=\"https:\/\/github.com\/wnameless\/docker-oracle-xe-11g\">\u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435<\/a> \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u043b\u0430\u0431\u044b\u0435 \u043c\u0435\u0441\u0442\u0430 \u0438 \u043d\u0435\u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b\u0435 \u043f\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u043f\u0443\u043d\u043a\u0442\u0430\u043c \u0441 best practices:<\/p>\n<h4>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 .dockerignore<\/h4>\n<p>  \u041e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b, \u043d\u043e \u043a \u0441\u043e\u0436\u0435\u043b\u0435\u043d\u0438\u044e \u043c\u043d\u043e\u0433\u0438\u0435 \u043e \u043d\u0435\u043c \u043d\u0435 \u0437\u043d\u0430\u044e\u0442 \u0438 \u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f.<br \/>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0437\u0430 \u0441\u0447\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0432 .dockerfile \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0441\u0431\u043e\u0440\u043a\u0438 \u043e\u0431\u0440\u0430\u0437\u0430 \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u0430\u0441\u044c \u0438, \u0447\u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435, \u0440\u0430\u0437\u043c\u0435\u0440 \u043e\u0431\u0440\u0430\u0437\u0430 \u0441\u0442\u0430\u043b \u043c\u0435\u043d\u044c\u0448\u0435 <b>\u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c \u043d\u0430 2Gb<\/b><\/p>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u0447\u0442\u043e \u0432 git \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0442\u044f\u0436\u0435\u043b\u044b\u0435 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 best practice, \u043d\u043e \u043f\u043e\u043a\u0430 \u0443\u043f\u0443\u0441\u0442\u0438\u043c \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u0430\u043a \u043c\u043e\u0434\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u00ab\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u2014 \u043d\u0435 \u0442\u0440\u043e\u0433\u0430\u0439\u00bb, \u0438\u043b\u0438 \u043a\u0430\u043a \u043b\u044e\u0431\u044f\u0442 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u0432 \u0411\u0440\u0438\u0442\u0430\u043d\u0438\u0438 \u00ab\u0422\u0430\u043a \u0438\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043b\u043e\u0436\u0438\u043b\u043e\u0441\u044c\u00bb.<\/p>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 <s>3<\/s> \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u043b\u0438 \u043e\u0431\u0440\u0430\u0437. \u0422\u0430\u043a-\u0436\u0435 \u044f \u043d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e .git \u0432\u043d\u043e\u0441\u0438\u0442\u044c \u0432 .dockerignore, \u0442.\u043a. \u0432 \u044d\u0442\u043e\u0439 \u043f\u0430\u043f\u043a\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432\u0432\u0435\u0441\u044c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439, \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0442\u0430-\u0436\u0435 \u043a\u043e\u043f\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432.<\/p>\n<pre><code class=\"bash\">oracle-xe_11.2.0-1.0_amd64.debaa oracle-xe_11.2.0-1.0_amd64.debab oracle-xe_11.2.0-1.0_amd64.debac .git .gitignore <\/code><\/pre>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440<\/h4>\n<p>  \u042d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430, \u0438 \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0437\u0430 \u0441\u0447\u0435\u0442 \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u043b\u044e\u0434\u0438 \u043d\u0435 \u0434\u043e\u043a\u043e\u043d\u0446\u0430 \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u0442 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0438 \u0440\u0438\u0441\u043a\u0438.<br \/>  \u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0432 \u0433\u043b\u0430\u0437\u0430 \u043a\u0438\u0434\u0430\u0435\u0442\u0441\u044f SSHD \u0438 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f <b>CMD<\/b>  <\/p>\n<pre><code class=\"bash\">CMD sed -i -E &quot;s\/HOST = [^)]+\/HOST = $HOSTNAME\/g&quot; \/u01\/app\/oracle\/product\/11.2.0\/xe\/network\/admin\/listener.ora; \\ \tservice oracle-xe start; \\ \t\/usr\/sbin\/sshd -D <\/code><\/pre>\n<p>  \u041c\u0438\u043d\u0443\u0441\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0434\u043e\u043b\u0433\u043e, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u0445\u043e\u0447\u0435\u0442 \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u044f\u0449\u0443\u044e \u043a\u043e\u043c\u043c\u0430\u043d\u0434\u0443.<\/p>\n<p>  \u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0443\u0434\u0430\u043b\u044f\u0435\u043c SSHD \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u0435\u043d, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043d\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c debug \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0441\u044f \u043a \u043a\u043e\u043d\u0441\u043e\u043b\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <b>bash exec -it ${CONTAINER_ID} \/bin\/bash<\/b><\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e \u0447\u0442\u043e \u043f\u0440\u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 Gracefully \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e SSHD, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f, \u043a\u0430\u043a <b>\u0441\u0430\u043c\u0430 \u0431\u0430\u0437\u0430 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e TERM \u0441\u0438\u0433\u043d\u0430\u043b\u0443<\/b> \u043a\u0430\u043a \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0431\u0435\u0437 \u043f\u0430\u0440\u0440\u0435\u043d\u0442\u0430, \u0447\u0442\u043e \u043d\u0435 \u0435\u0441\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u043e, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0434\u043b\u044f Oracle DB.<\/p>\n<p>  \u043f\u043e sed \u0438 service start \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0447\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442, \u0438 \u0440\u0430\u0437\u0443\u043c\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u0432\u0432\u0435\u0441\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0432 entrypoint.sh<\/p>\n<p>  \u041f\u0440\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0435 ENTRYPOINT \u0431\u044b\u043b \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e <s>\u043a\u043e\u0441\u0442\u044b\u043b\u0435\u0439<\/s> workarounds (\u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0438\u0442-\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u0435\u0439). \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 ENTRYPOINT \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0438\u0436\u0435, \u0442.\u043a. \u043e\u043d \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u0435\u0442 \u0441\u0440\u0430\u0437\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0443\u043d\u043a\u0442\u043e\u0432<\/p>\n<h4>\u041c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u043b\u043e\u0435\u0432<\/h4>\n<p>  \u042d\u0442\u043e\u0442 \u043f\u0443\u043d\u043a\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442, \u043d\u043e \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u0447\u0435\u043d\u043e \u0432\u0430\u0436\u0435\u043d, \u0442\u0430\u043a \u043a\u0430\u043a Docker \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e \u043d\u0430\u0441\u043b\u043e\u0435\u043d\u0438\u044e \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u0424\u0421 \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u043d\u0430 \u043a\u0430\u0436\u0434\u0443\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e, \u0432\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u0441\u0442\u0430\u0440\u0430\u0442\u0441\u044f \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u043e\u0434 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u043c \u0438 \u0432\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432\u0441\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043e\u0434\u043d\u0443 RUN \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e  <\/p>\n<pre><code class=\"bash\"># Prepare to install Oracle RUN apt-get update && apt-get install -y -q libaio1 net-tools bc curl && \\ apt-get clean && \\ rm -rf \/tmp\/* \/var\/lib\/apt\/lists\/* \/var\/tmp\/* &&\\ ln -s \/usr\/bin\/awk \/bin\/awk &&\\ mkdir \/var\/lock\/subsys &&\\ chmod 755 \/sbin\/chkconfig &&\\ \/oracle-install.sh <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043f\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 oracle \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0435\u043d \u0432 sh \u0441\u043a\u0440\u0438\u043f\u0442 \u0432 \u043f\u043e\u043b\u044c\u0437\u0443 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<h4>\u0418\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 <s>\u043b\u0438\u0448\u043d\u0438\u0445<\/s> \u043d\u0435 \u0441\u0430\u043c\u044b\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432<\/h4>\n<p>  \u041f\u043e\u043c\u0438\u043c\u043e \u043e\u0442\u043a\u0430\u0437\u0430 \u043e\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043b\u0438\u0448\u043d\u0438\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0442\u0430\u043a-\u0436\u0435 \u043a\u0440\u0430\u0439\u043d\u0435 \u0432\u0430\u0436\u043d\u043e \u043e\u0447\u0438\u0449\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435 \u0441\u0435\u0431\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b, \u043a\u0435\u0448\u0438 \u0438 \u043f\u0440\u043e\u0447\u0435\u0435 \u0432 \u043e\u0434\u043d\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u0441\u043b\u043e\u0435\u043d\u0438\u044f \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u043e\u0435\u0432, \u0438\u043d\u0430\u0447\u0435 \u043e\u0431\u0440\u0430\u0437 \u0431\u0443\u0434\u0435\u0442 \u0432\u0434\u0432\u043e\u0439\u043d\u0435 \u0442\u044f\u0436\u0435\u043b\u0435\u0439.<\/p>\n<pre><code class=\"bash\">apt-get clean && \\ rm -rf \/tmp\/* \/var\/lib\/apt\/lists\/* \/var\/tmp\/* \/download\/directory <\/code><\/pre>\n<h4>\u041a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u044d\u0444\u0438\u043c\u0435\u0440\u043d\u044b\u0439<\/h4>\n<p>  \u042d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0438 \u0432\u0430\u0436\u043d\u044b\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432. \u041f\u043e\u0434 \u043f\u043e\u043d\u044f\u0442\u0438\u0435\u043c \u00ab\u042d\u0444\u0438\u043c\u0435\u0440\u043d\u044b\u0439\u00bb \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430, \u0430 \u0437\u0430\u0442\u0435\u043c \u0435\u0433\u043e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0441 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435\u043c, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u0440\u0435\u0434\u0438\u0434\u0443\u0449\u0435\u0433\u043e \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439.<\/p>\n<p>  \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0444\u0430\u0439\u043b\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 (\u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u0430\u043a \u0445\u043e\u043b\u043e\u0434\u043d\u044b\u0439 \u0431\u044d\u043a\u0430\u043f) \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430.<\/p>\n<p>  \u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0438 Docker \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u043b\u0435\u0433\u043a\u043e \u0438 \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u0443\u044e \u043a\u043e\u043f\u0438\u044e, \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e \u043e\u0442\u043a\u0430\u0442\u0438\u0442\u0441\u044f \u0438 \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u044e \u0431\u0430\u0437\u0443.<\/p>\n<p>  \u0422\u0430\u043a-\u0436\u0435 \u043d\u0435 \u043c\u0430\u043b\u043e \u0432\u0430\u0436\u043d\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u0430\u043a \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 ENV \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435.<\/p>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 ENTRYPOINT<\/p>\n<pre><code class=\"bash\">#!\/bin\/bash  # Prevent owner issues on mounted folders chown -R oracle:dba \/u01\/app\/oracle rm -f \/u01\/app\/oracle\/product ln -s \/u01\/app\/oracle-product \/u01\/app\/oracle\/product # Update hostname sed -i -E &quot;s\/HOST = [^)]+\/HOST = $HOSTNAME\/g&quot; \/u01\/app\/oracle\/product\/11.2.0\/xe\/network\/admin\/listener.ora sed -i -E &quot;s\/PORT = [^)]+\/PORT = 1521\/g&quot; \/u01\/app\/oracle\/product\/11.2.0\/xe\/network\/admin\/listener.ora echo &quot;export ORACLE_HOME=\/u01\/app\/oracle\/product\/11.2.0\/xe&quot; &gt; \/etc\/profile.d\/oracle-xe.sh echo &quot;export PATH=\\$ORACLE_HOME\/bin:\\$PATH&quot; &gt;&gt; \/etc\/profile.d\/oracle-xe.sh echo &quot;export ORACLE_SID=XE&quot; &gt;&gt; \/etc\/profile.d\/oracle-xe.sh . \/etc\/profile  case &quot;$1&quot; in \t'') \t\t#Check for mounted database files \t\tif [ &quot;$(ls -A \/u01\/app\/oracle\/oradata)&quot; ]; then \t\t\techo &quot;found files in \/u01\/app\/oracle\/oradata Using them instead of initial database&quot; \t\t\techo &quot;XE:$ORACLE_HOME:N&quot; &gt;&gt; \/etc\/oratab \t\t\tchown oracle:dba \/etc\/oratab \t\t\tchown 664 \/etc\/oratab \t\t\tprintf &quot;ORACLE_DBENABLED=false\\nLISTENER_PORT=1521\\nHTTP_PORT=8080\\nCONFIGURE_RUN=true\\n&quot; &gt; \/etc\/default\/oracle-xe \t\t\trm -rf \/u01\/app\/oracle-product\/11.2.0\/xe\/dbs \t\t\tln -s \/u01\/app\/oracle\/dbs \/u01\/app\/oracle-product\/11.2.0\/xe\/dbs \t\telse \t\t\techo &quot;Database not initialized. Initializing database.&quot;  \t\t\tprintf &quot;Setting up:\\nprocesses=$processes\\nsessions=$sessions\\ntransactions=$transactions\\n&quot; \t\t\techo &quot;If you want to use different parameters set processes, sessions, transactions env variables and consider this formula:&quot; \t\t\tprintf &quot;processes=x\\nsessions=x*1.1+5\\ntransactions=sessions*1.1\\n&quot;  \t\t\tmv \/u01\/app\/oracle-product\/11.2.0\/xe\/dbs \/u01\/app\/oracle\/dbs \t\t\tln -s \/u01\/app\/oracle\/dbs \/u01\/app\/oracle-product\/11.2.0\/xe\/dbs  \t\t\t#Setting up processes, sessions, transactions. \t\t\tsed -i -E &quot;s\/processes=[^)]+\/processes=$processes\/g&quot; \/u01\/app\/oracle\/product\/11.2.0\/xe\/config\/scripts\/init.ora \t\t\tsed -i -E &quot;s\/processes=[^)]+\/processes=$processes\/g&quot; \/u01\/app\/oracle\/product\/11.2.0\/xe\/config\/scripts\/initXETemp.ora \t\t\t \t\t\tsed -i -E &quot;s\/sessions=[^)]+\/sessions=$sessions\/g&quot; \/u01\/app\/oracle\/product\/11.2.0\/xe\/config\/scripts\/init.ora \t\t\tsed -i -E &quot;s\/sessions=[^)]+\/sessions=$sessions\/g&quot; \/u01\/app\/oracle\/product\/11.2.0\/xe\/config\/scripts\/initXETemp.ora  \t\t\tsed -i -E &quot;s\/transactions=[^)]+\/transactions=$transactions\/g&quot; \/u01\/app\/oracle\/product\/11.2.0\/xe\/config\/scripts\/init.ora \t\t\tsed -i -E &quot;s\/transactions=[^)]+\/transactions=$transactions\/g&quot; \/u01\/app\/oracle\/product\/11.2.0\/xe\/config\/scripts\/initXETemp.ora  \t\t\tprintf 8080\\\\n1521\\\\noracle\\\\noracle\\\\ny\\\\n | \/etc\/init.d\/oracle-xe configure  \t\t\techo &quot;Database initialized. Please visit http:\/\/#containeer:8080\/apex to proceed with configuration&quot; \t\tfi  \t\t\/etc\/init.d\/oracle-xe start \t\techo &quot;Database ready to use. Enjoy! ;)&quot;  \t\t## \t\t## Workaround for graceful shutdown. oracle... \u203f( \u0301 \u0335 _-`)\u203f \t\t## \t\twhile [ &quot;$END&quot; == '' ]; do \t\t\tsleep 1 \t\t\ttrap &quot;\/etc\/init.d\/oracle-xe stop && END=1&quot; INT TERM \t\tdone \t\t;;  \t*) \t\techo &quot;Database is not configured. Please run \/etc\/init.d\/oracle-xe configure if needed.&quot; \t\t$1 \t\t;; esac <\/code><\/pre>\n<h4>\u0420\u0435\u0437\u044e\u043c\u0435<\/h4>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435, \u0441\u043b\u0435\u0434\u0443\u044f Best Practices \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0446\u0435\u043b\u044b\u0439 \u0440\u044f\u0434 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432:  <\/p>\n<ul>\n<li>\u0420\u0430\u0437\u043c\u0435\u0440 \u043e\u0431\u0440\u0430\u0437\u0430 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b\u0441\u044f \u043d\u0430 3GB (\u0441 3.8Gb \u0434\u043e 825Mb) <\/li>\n<li>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u0442\u0430-\u0444\u0430\u0439\u043b\u043e\u0432<\/li>\n<li>Graceful \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430<\/li>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u043d\u043a\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u0431\u0430\u0437\u044b \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430<\/li>\n<\/ul>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0438 \u0434\u0435\u0442\u0430\u043b\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u043d\u0430 <a href=\"https:\/\/github.com\/MaksymBilenko\/docker-oracle-xe-11g\">github<\/a> \u0438 <a href=\"https:\/\/registry.hub.docker.com\/u\/sath89\/oracle-xe-11g\/\">hub.docker.com<\/a><\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.     \t<\/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\/260305\/\"> http:\/\/habrahabr.ru\/post\/260305\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t<img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/f99\/773\/96f\/f9977396f04e4f328bf13b56420ff70f.jpg\"\/><\/p>\n<p>  Docker \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0441\u0442\u0430\u043b \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u0435\u043d \u0437\u0430 \u0441\u0447\u0435\u0442 \u0441\u0432\u043e\u0435\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u0438 \u0438, \u0433\u043b\u0430\u0432\u043d\u043e\u0435, \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b.<\/p>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0442\u044b\u0441\u044f\u0447\u0438 \u043e\u0431\u0440\u0430\u0437\u043e\u0432 \u0432 <a href=\"http:\/\/hub.docker.com\">hub.docker.com<\/a>. \u0417\u0430 \u0441\u0447\u0435\u0442 \u0441\u0432\u043e\u0435\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043e\u0431\u0440\u0430\u0437\u043e\u0432, \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u0437\u0430 \u043f\u043e\u043b \u0447\u0430\u0441\u0430 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u0432\u043d\u043e\u0441\u0438\u0442\u044c \u0441\u0432\u043e\u0439 \u0432\u043a\u043b\u0430\u0434.<\/p>\n<p>  \u041d\u043e \u043c\u043d\u043e\u0433\u0438\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u044e\u0442 \u043e <a href=\"https:\/\/docs.docker.com\/articles\/dockerfile_best-practices\/\">best practices<\/a>, \u0438 \u0437\u0430 \u0441\u0447\u0435\u0442 \u044d\u0442\u043e\u0433\u043e docker hub \u043d\u0430\u043f\u043e\u043b\u043d\u0438\u043b\u0441\u044f \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043d\u0435 \u0441\u0430\u043c\u044b\u0445 \u043b\u0443\u0447\u0448\u0438\u0445 \u043e\u0431\u0440\u0430\u0437\u043e\u0432.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0447\u0443 \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0437\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Best Practices \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435.  <\/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-259356","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/259356","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=259356"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/259356\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=259356"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=259356"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=259356"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}