{"version":"1.0","provider_name":"Docker-Profis","provider_url":"https:\/\/dockerpros.com\/de","title":"Docker Stack Up - Dockerpros","type":"rich","width":600,"height":338,"html":"<blockquote class=\"wp-embedded-content\" data-secret=\"o1NEHqA1fL\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/docker-stack-up\/\">Docker Stack Up\n\nIn this chapter, we will learn how to use Docker Stack to deploy and manage multi-container applications. Docker Stack is a tool that allows you to define and run multi-container applications using Docker Compose files. It provides a way to manage the lifecycle of your application, including scaling, updating, and rolling back changes.\n\nTo get started with Docker Stack, you need to have Docker installed on your system. You can download and install Docker from the official Docker website. Once you have Docker installed, you can use the following command to check if it is working correctly:\n\n```\ndocker --version\n```\n\nIf Docker is installed correctly, you should see the version number of Docker displayed on the screen.\n\nNow, let's create a simple Docker Compose file to define our multi-container application. Create a new file called `docker-compose.yml` and add the following content:\n\n```yaml\nversion: '3'\nservices:\n  web:\n    image: nginx\n    ports:\n      - \"80:80\"\n  db:\n    image: mysql\n    environment:\n      MYSQL_ROOT_PASSWORD: password\n```\n\nIn this example, we have defined two services: `web` and `db`. The `web` service uses the `nginx` image and exposes port 80. The `db` service uses the `mysql` image and sets the `MYSQL_ROOT_PASSWORD` environment variable to `password`.\n\nTo deploy this application using Docker Stack, you can use the following command:\n\n```\ndocker stack deploy -c docker-compose.yml myapp\n```\n\nThis command will create a new stack called `myapp` and deploy the services defined in the `docker-compose.yml` file. You can check the status of the stack using the following command:\n\n```\ndocker stack services myapp\n```\n\nThis command will display the status of all the services in the `myapp` stack. You can also check the logs of a specific service using the following command:\n\n```\ndocker service logs myapp_web\n```\n\nThis command will display the logs of the `web` service in the `myapp` stack.\n\nTo scale a service, you can use the following command:\n\n```\ndocker service scale myapp_web=3\n```\n\nThis command will scale the `web` service in the `myapp` stack to 3 replicas.\n\nTo update a service, you can use the following command:\n\n```\ndocker service update --image nginx:latest myapp_web\n```\n\nThis command will update the `web` service in the `myapp` stack to use the latest version of the `nginx` image.\n\nTo roll back a service to a previous version, you can use the following command:\n\n```\ndocker service rollback myapp_web\n```\n\nThis command will roll back the `web` service in the `myapp` stack to the previous version.\n\nIn conclusion, Docker Stack is a powerful tool that allows you to define and manage multi-container applications using Docker Compose files. It provides a way to manage the lifecycle of your application, including scaling, updating, and rolling back changes. With Docker Stack, you can easily deploy and manage complex applications with ease.<\/a><\/blockquote><iframe sandbox=\"allow-scripts\" security=\"restricted\" src=\"https:\/\/dockerpros.com\/de\/wiki\/docker-stack-up\/embed\/#?secret=o1NEHqA1fL\" width=\"600\" height=\"338\" title=\"\u201eDocker Stack Up\u201c \u2013 Dockerpros\" data-secret=\"o1NEHqA1fL\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" class=\"wp-embedded-content\"><\/iframe><script>\n\/**\n * WordPress inline HTML embed\n *\n * @since 4.4.0\n * @output wp-includes\/js\/wp-embed.js\n *\n * Single line comments should not be used since they will break\n * the script when inlined in get_post_embed_html(), specifically\n * when the comments are not stripped out due to SCRIPT_DEBUG\n * being turned on.\n *\/\n(function ( window, document ) {\n\t'use strict';\n\n\t\/* Abort for ancient browsers. *\/\n\tif ( ! document.querySelector || ! window.addEventListener || typeof URL === 'undefined' ) {\n\t\treturn;\n\t}\n\n\t\/** @namespace wp *\/\n\twindow.wp = window.wp || {};\n\n\t\/* Abort if script was already executed. *\/\n\tif ( !! window.wp.receiveEmbedMessage ) {\n\t\treturn;\n\t}\n\n\t\/**\n\t * Receive embed message.\n\t *\n\t * @param {MessageEvent} e\n\t *\/\n\twindow.wp.receiveEmbedMessage = function( e ) {\n\t\tvar data = e.data;\n\n\t\t\/* Verify shape of message. *\/\n\t\tif (\n\t\t\t! ( data || data.secret || data.message || data.value ) ||\n\t\t\t\/[^a-zA-Z0-9]\/.test( data.secret )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar iframes = document.querySelectorAll( 'iframe[data-secret=\"' + data.secret + '\"]' ),\n\t\t\tblockquotes = document.querySelectorAll( 'blockquote[data-secret=\"' + data.secret + '\"]' ),\n\t\t\tallowedProtocols = new RegExp( '^https?:$', 'i' ),\n\t\t\ti, source, height, sourceURL, targetURL;\n\n\t\tfor ( i = 0; i < blockquotes.length; i++ ) {\n\t\t\tblockquotes[ i ].style.display = 'none';\n\t\t}\n\n\t\tfor ( i = 0; i < iframes.length; i++ ) {\n\t\t\tsource = iframes[ i ];\n\n\t\t\tif ( e.source !== source.contentWindow ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tsource.removeAttribute( 'style' );\n\n\t\t\tif ( 'height' === data.message ) {\n\t\t\t\t\/* Resize the iframe on request. *\/\n\t\t\t\theight = parseInt( data.value, 10 );\n\t\t\t\tif ( height > 1000 ) {\n\t\t\t\t\theight = 1000;\n\t\t\t\t} else if ( ~~height < 200 ) {\n\t\t\t\t\theight = 200;\n\t\t\t\t}\n\n\t\t\t\tsource.height = height;\n\t\t\t} else if ( 'link' === data.message ) {\n\t\t\t\t\/* Link to a specific URL on request. *\/\n\t\t\t\tsourceURL = new URL( source.getAttribute( 'src' ) );\n\t\t\t\ttargetURL = new URL( data.value );\n\n\t\t\t\tif (\n\t\t\t\t\tallowedProtocols.test( targetURL.protocol ) &&\n\t\t\t\t\ttargetURL.host === sourceURL.host &&\n\t\t\t\t\tdocument.activeElement === source\n\t\t\t\t) {\n\t\t\t\t\twindow.top.location.href = data.value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\n\tfunction onLoad() {\n\t\tvar iframes = document.querySelectorAll( 'iframe.wp-embedded-content' ),\n\t\t\ti, source, secret;\n\n\t\tfor ( i = 0; i < iframes.length; i++ ) {\n\t\t\t\/** @var {IframeElement} *\/\n\t\t\tsource = iframes[ i ];\n\n\t\t\tsecret = source.getAttribute( 'data-secret' );\n\t\t\tif ( ! secret ) {\n\t\t\t\t\/* Add secret to iframe *\/\n\t\t\t\tsecret = Math.random().toString( 36 ).substring( 2, 12 );\n\t\t\t\tsource.src += '#?secret=' + secret;\n\t\t\t\tsource.setAttribute( 'data-secret', secret );\n\t\t\t}\n\n\t\t\t\/*\n\t\t\t * Let post embed window know that the parent is ready for receiving the height message, in case the iframe\n\t\t\t * loaded before wp-embed.js was loaded. When the ready message is received by the post embed window, the\n\t\t\t * window will then (re-)send the height message right away.\n\t\t\t *\/\n\t\t\tsource.contentWindow.postMessage( {\n\t\t\t\tmessage: 'ready',\n\t\t\t\tsecret: secret\n\t\t\t}, '*' );\n\t\t}\n\t}\n\n\twindow.addEventListener( 'message', window.wp.receiveEmbedMessage, false );\n\tdocument.addEventListener( 'DOMContentLoaded', onLoad, false );\n})( window, document );\n\/\/# sourceURL=https:\/\/dockerpros.com\/wp-includes\/js\/wp-embed.js\n<\/script>","thumbnail_url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-stack-up_1137.jpg","thumbnail_width":800,"thumbnail_height":600,"description":"Docker Stack Up simplifies the deployment and management of multi-container applications. By using Docker Compose files, it allows developers to define and orchestrate services seamlessly in a scalable environment."}