{"id":11169,"date":"2018-05-03T06:08:43","date_gmt":"2018-05-03T04:08:43","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/adwc-a-docker-container-to-startstop-oracle-cloud-services\/"},"modified":"2018-05-03T06:08:43","modified_gmt":"2018-05-03T04:08:43","slug":"adwc-a-docker-container-to-startstop-oracle-cloud-services","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/adwc-a-docker-container-to-startstop-oracle-cloud-services\/","title":{"rendered":"ADWC &#8211; a Docker container to start\/stop Oracle Cloud services"},"content":{"rendered":"<h2>By Franck Pachot<\/h2>\n<p>.<br \/>\nIn the <a href=\"https:\/\/www.dbi-services.com\/blog\/adwc-startstop-with-psm-command-line-interface\" target=\"_blank\" rel=\"noopener noreferrer\">previous post<\/a>, I&#8217;ve explained how to start and stop the Autonomous Data Warehouse Cloud service from PSM (PaaS Service Manager). There&#8217;s a setup phase, and a run phase starting with service-start and ending with service-stop. And the setup is specific to an Oracle Cloud account, storing information in the local user home. You may want to run different setups, and even provide an easy way to start\/stop an Oracle Cloud service without knowing the user, password and tenant name. <\/p>\n<p>A Docker container is perfect to isolate this.<br \/>\n<!--more--><\/p>\n<h3>Dockerfile<\/h3>\n<p>Here is my quick (aka experimental) Dockerfile:<\/p>\n<pre><code>\nFROM alpine:latest\nRUN apk add --update --no-cache python3 curl\nENV user=my.cloud.account@me.com\nENV password=MyP@ssw0rd\nENV tenant=idcs-31bbd63c3cb9466cb8a96f627b6b6116 \nENV region=us\n# get PSM\nRUN curl -X GET -u ${user}:${password} -H X-ID-TENANT-NAME:${tenant} https:\/\/psm.us.oraclecloud.com\/paas\/core\/api\/v1.1\/cli\/${tenant}\/client -o psmcli.zip\n# install PSM\nRUN pip3 install -U psmcli.zip\n# setup PSM\nRUN echo \"{\"username\":\"${user}\",\"password\":\"${password}\",\"identityDomain\":\"${tenant}\",\"region\":\"${region}\",\"outputFormat\":\"short\"}\" &gt; config-payload &amp;&amp;\n    psm setup --config-payload config-payload &amp;&amp;\n    rm 421d64918638 # remove file with password\n# patch PSM for bugs\nRUN sed -ie 's\/core\\[\/]\/\/g' ~\/.psm\/data\/ADWC.json\n# variables which can be overwritten at run time\nENV service=ADWC\nENV name=MYADWC1\nCMD trap 'echo \"Stopping service ${service}...\";psm ${service} stop-service --service-name ${name} -wc true ; exit 0'  SIGINT SIGSTOP SIGKILL; echo \"Starting service ${service}...\";psm ${service} start-service --service-name ${name} -wc true || exit 1 ; echo \"You can access to ${service} console with ADMIN user at:\";echo;psm ${service} service -s ${name} -of json | jq -r '.serviceConsole';echo ; while sleep 60 ; do echo \"Status of service ${service} at $(date)...\";psm ADWC service -s ADWC ; done\n<\/code><\/pre>\n<p>We need curl to download PSM, and pip3 to install it, and python3 to run it.<br \/>\nYou can set your Oracle Cloud Account credentials as environment variables.<br \/>\nThen it fills all required information in a &#8216;config-payload&#8217; file, runs &#8216;psm setup&#8217; and removes that file.<\/p>\n<p>At run, it calls a &#8216;start-service&#8217; and loops while showing the status every minute (you can see them with docker container logs). The INT, STOP and KILL signals call &#8216;stop-service&#8217;. Then, the idea is that while the container exists, the Cloud Service is running. And it is shutdown at the container end of life. There&#8217;s no other action to do with the container: it display the console url where you have everything to interact with the service (download client credentials, manage users, go to Machine Learning notebooks,&#8230;).<\/p>\n<h3>Run example:<\/h3>\n<p>Here is a simple example:<\/p>\n<pre><code>\n# docker run --rm  franck\/psm\/awdc\n&nbsp;\nStarting service MYADWC1...\n Message:    Job submitted successfully for start of service\/system\n Job ID:     25583108\nWaiting for the job to complete... (it cannot be cancelled)\nCommand completed with status [SUCCEED].\nYou can access to MYADWC1 console with ADMIN user at:\n&nbsp;\nh<i><\/i>ttps:\/\/adwc.uscom-east-1.oraclecloud.com\/console\/index.html?tenant_name=idcs-31bbd63c3cb9466cb8a96f627b6b6116&amp;database_name=MYADWC1\n&nbsp;\nStatus of service MYADWC1 at Sun Apr 29 18:20:50 UTC 2018...\n Service:                    MYADWC1\n Status:                     Ready\n Version:                    18.1.4.0\n Edition:                    N\/A\n Compute Site:               N\/A\n Cloud Storage Container:    N\/A\n Created On:                 2018-04-19T19:22:18.360+0000\nStatus of service MYADWC1 at Sun Apr 29 18:21:51 UTC 2018...\n Service:                    MYADWC1\n Status:                     Ready\n Version:                    18.1.4.0\n Edition:                    N\/A\n Compute Site:               N\/A\n Cloud Storage Container:    N\/A\n Created On:                 2018-04-19T19:22:18.360+0000\n&nbsp;\n^C\n&nbsp;\nStopping service MYADWC1...\n Message:    Job submitted successfully for stop of service\/system\n Job ID:     25620930\nWaiting for the job to complete... (it cannot be cancelled)\nCommand completed with status [SUCCEED].\n<\/code><\/pre>\n<p>After 2 minutes I&#8217;ve hit &#8216;Control-C&#8217; to stop the container. The service has been cleanly shut-down.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>By Franck Pachot . In the previous post, I&#8217;ve explained how to start and stop the Autonomous Data Warehouse Cloud service from PSM (PaaS Service Manager). There&#8217;s a setup phase, and a run phase starting with service-start and ending with service-stop. And the setup is specific to an Oracle Cloud account, storing information in the [&hellip;]<\/p>\n","protected":false},"author":27,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[955,59],"tags":[1347,1191,135,601,96,1184],"type_dbi":[],"class_list":["post-11169","post","type-post","status-publish","format-standard","hentry","category-cloud","category-oracle","tag-adwc","tag-autonomous","tag-cloud","tag-docker","tag-oracle","tag-oracle-18c"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>ADWC - a Docker container to start\/stop Oracle Cloud services - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/adwc-a-docker-container-to-startstop-oracle-cloud-services\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"ADWC - a Docker container to start\/stop Oracle Cloud services\" \/>\n<meta property=\"og:description\" content=\"By Franck Pachot . In the previous post, I&#8217;ve explained how to start and stop the Autonomous Data Warehouse Cloud service from PSM (PaaS Service Manager). There&#8217;s a setup phase, and a run phase starting with service-start and ending with service-stop. And the setup is specific to an Oracle Cloud account, storing information in the [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/adwc-a-docker-container-to-startstop-oracle-cloud-services\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-05-03T04:08:43+00:00\" \/>\n<meta name=\"author\" content=\"Oracle Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Oracle Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/adwc-a-docker-container-to-startstop-oracle-cloud-services\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/adwc-a-docker-container-to-startstop-oracle-cloud-services\/\"},\"author\":{\"name\":\"Oracle Team\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\"},\"headline\":\"ADWC &#8211; a Docker container to start\/stop Oracle Cloud services\",\"datePublished\":\"2018-05-03T04:08:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/adwc-a-docker-container-to-startstop-oracle-cloud-services\/\"},\"wordCount\":269,\"commentCount\":0,\"keywords\":[\"ADWC\",\"Autonomous\",\"Cloud\",\"Docker\",\"Oracle\",\"Oracle 18c\"],\"articleSection\":[\"Cloud\",\"Oracle\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/adwc-a-docker-container-to-startstop-oracle-cloud-services\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/adwc-a-docker-container-to-startstop-oracle-cloud-services\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/adwc-a-docker-container-to-startstop-oracle-cloud-services\/\",\"name\":\"ADWC - a Docker container to start\/stop Oracle Cloud services - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"datePublished\":\"2018-05-03T04:08:43+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/adwc-a-docker-container-to-startstop-oracle-cloud-services\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/adwc-a-docker-container-to-startstop-oracle-cloud-services\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/adwc-a-docker-container-to-startstop-oracle-cloud-services\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ADWC &#8211; a Docker container to start\/stop Oracle Cloud services\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\",\"name\":\"Oracle Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g\",\"caption\":\"Oracle Team\"},\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/oracle-team\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"ADWC - a Docker container to start\/stop Oracle Cloud services - dbi Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/adwc-a-docker-container-to-startstop-oracle-cloud-services\/","og_locale":"en_US","og_type":"article","og_title":"ADWC - a Docker container to start\/stop Oracle Cloud services","og_description":"By Franck Pachot . In the previous post, I&#8217;ve explained how to start and stop the Autonomous Data Warehouse Cloud service from PSM (PaaS Service Manager). There&#8217;s a setup phase, and a run phase starting with service-start and ending with service-stop. And the setup is specific to an Oracle Cloud account, storing information in the [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/adwc-a-docker-container-to-startstop-oracle-cloud-services\/","og_site_name":"dbi Blog","article_published_time":"2018-05-03T04:08:43+00:00","author":"Oracle Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Oracle Team","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/adwc-a-docker-container-to-startstop-oracle-cloud-services\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/adwc-a-docker-container-to-startstop-oracle-cloud-services\/"},"author":{"name":"Oracle Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee"},"headline":"ADWC &#8211; a Docker container to start\/stop Oracle Cloud services","datePublished":"2018-05-03T04:08:43+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/adwc-a-docker-container-to-startstop-oracle-cloud-services\/"},"wordCount":269,"commentCount":0,"keywords":["ADWC","Autonomous","Cloud","Docker","Oracle","Oracle 18c"],"articleSection":["Cloud","Oracle"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/adwc-a-docker-container-to-startstop-oracle-cloud-services\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/adwc-a-docker-container-to-startstop-oracle-cloud-services\/","url":"https:\/\/www.dbi-services.com\/blog\/adwc-a-docker-container-to-startstop-oracle-cloud-services\/","name":"ADWC - a Docker container to start\/stop Oracle Cloud services - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2018-05-03T04:08:43+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/adwc-a-docker-container-to-startstop-oracle-cloud-services\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/adwc-a-docker-container-to-startstop-oracle-cloud-services\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/adwc-a-docker-container-to-startstop-oracle-cloud-services\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"ADWC &#8211; a Docker container to start\/stop Oracle Cloud services"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee","name":"Oracle Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g","caption":"Oracle Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/oracle-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/11169","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/27"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=11169"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/11169\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=11169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=11169"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=11169"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=11169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}