{"id":2587,"date":"2019-09-20T15:47:58","date_gmt":"2019-09-20T07:47:58","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/iotdev\/?p=2587"},"modified":"2019-09-21T01:10:15","modified_gmt":"2019-09-20T17:10:15","slug":"convert-your-docker-compose-project-to-azure-iot-edge-solution","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/iotdev\/convert-your-docker-compose-project-to-azure-iot-edge-solution\/","title":{"rendered":"Convert your docker-compose Project to Azure IoT Edge Solution"},"content":{"rendered":"<p>If you are a container expert, you may want to port your existing compose application to Azure IoT Edge. We are glad to introduce <a href=\"https:\/\/pypi.org\/project\/iotedge-compose\/\"><em>iotedge-compose<\/em><\/a> to help convert your docker-compose project to Azure IoT Edge. Let us see how it works.<\/p>\n<h2>Prerequisites<\/h2>\n<ul>\n<li>Make sure <a href=\"https:\/\/www.docker.com\/products\/docker-desktop\">Docker Desktop<\/a> is running on your system before using this tool.<\/li>\n<li><a href=\"https:\/\/www.python.org\/downloads\/\">Python<\/a> version &gt;= 3.6.0 and Pip.<\/li>\n<li><a href=\"https:\/\/code.visualstudio.com\/\">Visual Studio Code<\/a> and <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=vsciot-vscode.azure-iot-tools\">Azure IoT Tools for VS Code<\/a>.<\/li>\n<li>Necessary Azure resources when developing Azure IoT Edge (IoT Hub with an IoT Edge device ID and Azure Container Registry)<\/li>\n<\/ul>\n<h2>Install the Tool and Convert a Sample Project<\/h2>\n<ol>\n<li>Install the tool by running the following command\n<pre class=\"lang:default decode:true \">pip install iotedge-compose<\/pre>\n<\/li>\n<li>Clone a sample docker-compose project\n<pre class=\"lang:default decode:true \">git clone https:\/\/github.com\/shizn\/iotedge-compose-hello-world.git<\/pre>\n<\/li>\n<li>Run the sample application\n<pre class=\"lang:default decode:true \">cd iotedge-compose-hello-world.git\/app\r\ndocker-compose up<\/pre>\n<\/li>\n<li>Enter <a href=\"http:\/\/localhost:5000\/\">http:\/\/localhost:5000\/ <\/a>in a browser to see the application running\n<img decoding=\"async\" class=\"alignnone wp-image-2588\" src=\"https:\/\/devblogs.microsoft.com\/iotdev\/wp-content\/uploads\/sites\/24\/2019\/09\/Picture1.png\" alt=\"\" width=\"392\" height=\"174\" srcset=\"https:\/\/devblogs.microsoft.com\/iotdev\/wp-content\/uploads\/sites\/24\/2019\/09\/Picture1.png 595w, https:\/\/devblogs.microsoft.com\/iotdev\/wp-content\/uploads\/sites\/24\/2019\/09\/Picture1-300x133.png 300w\" sizes=\"(max-width: 392px) 100vw, 392px\" \/><\/li>\n<li>Press <strong>CTRL+Z<\/strong> or run <strong>docker-compose down<\/strong> in the terminal to stop the sample app.<\/li>\n<li>Convert this compose app project to IoT Edge app project by running the following command\n<pre class=\"lang:default decode:true \">cd ..\r\niotedge-compose -t project -i app\/docker-compose.yml -o app-edge<\/pre>\n<\/li>\n<\/ol>\n<h2>Build and deploy converted project to IoT Edge device<\/h2>\n<p>Now you should see an app-edge folder in the root folder, this folder is the converted Azure IoT Edge project.<\/p>\n<ol>\n<li>Open app-edge project with VS Code\n<pre class=\"lang:default decode:true \">code app-edge<\/pre>\n<\/li>\n<li>Update the .env file with your Azure Container Registry info.\n<img decoding=\"async\" class=\"alignnone wp-image-2589\" src=\"https:\/\/devblogs.microsoft.com\/iotdev\/wp-content\/uploads\/sites\/24\/2019\/09\/Picture2.png\" alt=\"\" width=\"547\" height=\"160\" srcset=\"https:\/\/devblogs.microsoft.com\/iotdev\/wp-content\/uploads\/sites\/24\/2019\/09\/Picture2.png 766w, https:\/\/devblogs.microsoft.com\/iotdev\/wp-content\/uploads\/sites\/24\/2019\/09\/Picture2-300x88.png 300w\" sizes=\"(max-width: 547px) 100vw, 547px\" \/><\/li>\n<li>Update the repository URL in module.json\n<img decoding=\"async\" class=\"alignnone wp-image-2590\" src=\"https:\/\/devblogs.microsoft.com\/iotdev\/wp-content\/uploads\/sites\/24\/2019\/09\/Picture3.png\" alt=\"\" width=\"478\" height=\"340\" srcset=\"https:\/\/devblogs.microsoft.com\/iotdev\/wp-content\/uploads\/sites\/24\/2019\/09\/Picture3.png 612w, https:\/\/devblogs.microsoft.com\/iotdev\/wp-content\/uploads\/sites\/24\/2019\/09\/Picture3-300x213.png 300w\" sizes=\"(max-width: 478px) 100vw, 478px\" \/><\/li>\n<li>Login your docker registry with docker CLI and then click Build and Push the IoT Edge Solution in the context menu of deployment.template.json<\/li>\n<li>Create a deployment against your IoT Edge device id in Azure IoT Hub explorer with config\/deployment.amd64.json file. After a few seconds, you can see the module icon showing in the treeview. (The demo app does not include Azure IoT Device SDK, so both the web and redis module cannot return module status)\n<img decoding=\"async\" class=\"alignnone wp-image-2591\" src=\"https:\/\/devblogs.microsoft.com\/iotdev\/wp-content\/uploads\/sites\/24\/2019\/09\/Picture4.png\" alt=\"\" width=\"214\" height=\"184\" srcset=\"https:\/\/devblogs.microsoft.com\/iotdev\/wp-content\/uploads\/sites\/24\/2019\/09\/Picture4.png 314w, https:\/\/devblogs.microsoft.com\/iotdev\/wp-content\/uploads\/sites\/24\/2019\/09\/Picture4-300x258.png 300w\" sizes=\"(max-width: 214px) 100vw, 214px\" \/><\/li>\n<li>If you can access the IoT Edge device via public IP with port 5000 allowed, the demo page can be visited in your browser with <em>http:\/\/&lt;IoTEdgeDeviceAddress&gt;:5000\/\n<img decoding=\"async\" class=\"alignnone wp-image-2592\" src=\"https:\/\/devblogs.microsoft.com\/iotdev\/wp-content\/uploads\/sites\/24\/2019\/09\/Picture5.png\" alt=\"\" width=\"421\" height=\"150\" srcset=\"https:\/\/devblogs.microsoft.com\/iotdev\/wp-content\/uploads\/sites\/24\/2019\/09\/Picture5.png 666w, https:\/\/devblogs.microsoft.com\/iotdev\/wp-content\/uploads\/sites\/24\/2019\/09\/Picture5-300x107.png 300w\" sizes=\"(max-width: 421px) 100vw, 421px\" \/>\n<\/em><\/li>\n<\/ol>\n<h2>Summary<\/h2>\n<p>This blog walks you through the basic usage of the iotedge-compose tool with a hello world application. You can check the <a href=\"https:\/\/pypi.org\/project\/iotedge-compose\/\">iotedge-compose tool page<\/a> or the <a href=\"https:\/\/github.com\/shizn\/iotedge-compose-hello-world\">sample repo readme<\/a> to learn more. Send your feedback to vsciet@microsoft.com and let us know your feedback!<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are a container expert, you may want to port your existing compose application to Azure IoT Edge. We are glad to introduce iotedge-compose to help convert your docker-compose project to Azure IoT Edge. Let us see how it works. Prerequisites Make sure Docker Desktop is running on your system before using this tool. [&hellip;]<\/p>\n","protected":false},"author":531,"featured_media":1945,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[288],"tags":[164,11,20],"class_list":["post-2587","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-azure-iot-edge-development","tag-azure-iot-edge","tag-development-tools","tag-iot-edge"],"acf":[],"blog_post_summary":"<p>If you are a container expert, you may want to port your existing compose application to Azure IoT Edge. We are glad to introduce iotedge-compose to help convert your docker-compose project to Azure IoT Edge. Let us see how it works. Prerequisites Make sure Docker Desktop is running on your system before using this tool. [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/posts\/2587","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/users\/531"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/comments?post=2587"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/posts\/2587\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/media\/1945"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/media?parent=2587"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/categories?post=2587"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/tags?post=2587"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}