{"id":1342,"date":"2019-08-01T15:06:36","date_gmt":"2019-08-01T12:06:36","guid":{"rendered":"https:\/\/artem.services\/?p=1338"},"modified":"2019-08-01T15:14:55","modified_gmt":"2019-08-01T12:14:55","slug":"1342","status":"publish","type":"post","link":"https:\/\/artem.services\/?p=1342&lang=en","title":{"rendered":"\u00a0Docker &#8212; Multiple processes in one container"},"content":{"rendered":"<p><img loading=\"lazy\" class=\"size-full wp-image-27 aligncenter\" src=\"https:\/\/artem.services\/wp-content\/uploads\/2018\/10\/Docker-Logo.png\" alt=\"\" width=\"1800\" height=\"531\" srcset=\"https:\/\/artem.services\/wp-content\/uploads\/2018\/10\/Docker-Logo.png 1800w, https:\/\/artem.services\/wp-content\/uploads\/2018\/10\/Docker-Logo-300x89.png 300w, https:\/\/artem.services\/wp-content\/uploads\/2018\/10\/Docker-Logo-768x227.png 768w, https:\/\/artem.services\/wp-content\/uploads\/2018\/10\/Docker-Logo-1024x302.png 1024w, https:\/\/artem.services\/wp-content\/uploads\/2018\/10\/Docker-Logo-954x281.png 954w, https:\/\/artem.services\/wp-content\/uploads\/2018\/10\/Docker-Logo-1354x399.png 1354w\" sizes=\"(max-width: 1800px) 100vw, 1800px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span class=\"tlid-translation translation\" lang=\"en\"><span title=\"\">This example shows how to run 2 <strong>JAR<\/strong> files in one container.<\/span><\/p>\n<p><span title=\"\">As the base image we will use &quot;<strong>phusion\/baseimage<\/strong>&quot;<\/span><\/p>\n<p><span class=\"\" title=\"\">First you need to create startup scripts, for convenience, in the example they will be called &quot;<strong>start-first.sh<\/strong>&quot; and &quot;<strong>start-second.sh<\/strong>&quot;, in them we describe the launch of <strong>JAR<\/strong> files, for example<\/span><\/span><\/p>\n<h3>start-first.sh<\/h3>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n#!\/bin\/bash\r\njava -jar \/usr\/src\/app\/first.jar\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h3>start-second.sh<\/h3>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n#!\/bin\/bash\r\njava -jar \/usr\/src\/app\/second.jar\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">And create a <strong>Dockerfile<\/strong><\/span><\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nFROM phusion\/baseimage:latest\r\n\r\nCMD [&quot;\/sbin\/my_init&quot;]\r\n\r\nRUN add-apt-repository ppa:openjdk-r\/ppa &amp;&amp; \\\r\n    apt-get update -q &amp;&amp; \\\r\n    apt install -y openjdk-11-jdk\r\n\r\nCOPY .\/my_application \/usr\/src\/app\r\n\r\nWORKDIR \/usr\/src\/app\r\n\r\n# Add first service\r\nRUN mkdir \/etc\/service\/first\r\nADD start-first.sh \/etc\/service\/first\/run\r\nRUN chmod +x \/etc\/service\/first\/run\r\n\r\n# Add second service\r\nRUN mkdir \/etc\/service\/second\r\nADD start-second.sh \/etc\/service\/second\/run\r\nRUN chmod +x \/etc\/service\/second\/run\r\n\r\n# Clean up\r\nRUN apt-get clean &amp;&amp; rm -rf \/var\/lib\/apt\/lists\/* \/tmp\/* \/var\/tmp\/*\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; This example shows how to run 2 JAR files in one container. As the base image we will use &quot;phusion\/baseimage&quot; First you need to create startup scripts, for convenience, in the example they will be called &quot;start-first.sh&quot; and &quot;start-second.sh&quot;, in them we describe the launch of JAR files, for example start-first.sh &nbsp; start-second.sh &nbsp; &hellip; <a href=\"https:\/\/artem.services\/?p=1342&#038;lang=en\" class=\"more-link\">\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0447\u0438\u0442\u0430\u0442\u044c<span class=\"screen-reader-text\"> &quot;\u00a0Docker &#8212; Multiple processes in one container&quot;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[975],"tags":[635,771,823,1063,1065],"_links":{"self":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1342"}],"collection":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1342"}],"version-history":[{"count":2,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1342\/revisions"}],"predecessor-version":[{"id":1344,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1342\/revisions\/1344"}],"wp:attachment":[{"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1342"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1342"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}