<?xml version="1.0"?>
<oembed><version>1.0</version><provider_name>Docker-Profis</provider_name><provider_url>https://dockerpros.com/de</provider_url><title>Docker Stack Up - Dockerpros</title><type>rich</type><width>600</width><height>338</height><html>&lt;blockquote class="wp-embedded-content" data-secret="Vm94CM46Rb"&gt;&lt;a href="https://dockerpros.com/de/wiki/docker-stack-up/"&gt;Docker Stack Up

In 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.

To 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:

```
docker --version
```

If Docker is installed correctly, you should see the version number of Docker displayed on the screen.

Now, 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:

```yaml
version: '3'
services:
  web:
    image: nginx
    ports:
      - "80:80"
  db:
    image: mysql
    environment:
      MYSQL_ROOT_PASSWORD: password
```

In 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`.

To deploy this application using Docker Stack, you can use the following command:

```
docker stack deploy -c docker-compose.yml myapp
```

This 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:

```
docker stack services myapp
```

This 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:

```
docker service logs myapp_web
```

This command will display the logs of the `web` service in the `myapp` stack.

To scale a service, you can use the following command:

```
docker service scale myapp_web=3
```

This command will scale the `web` service in the `myapp` stack to 3 replicas.

To update a service, you can use the following command:

```
docker service update --image nginx:latest myapp_web
```

This command will update the `web` service in the `myapp` stack to use the latest version of the `nginx` image.

To roll back a service to a previous version, you can use the following command:

```
docker service rollback myapp_web
```

This command will roll back the `web` service in the `myapp` stack to the previous version.

In 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.&lt;/a&gt;&lt;/blockquote&gt;&lt;iframe sandbox="allow-scripts" security="restricted" src="https://dockerpros.com/de/wiki/docker-stack-up/embed/#?secret=Vm94CM46Rb" width="600" height="338" title="&#x201E;Docker Stack Up&#x201C; &#x2013; Dockerpros" data-secret="Vm94CM46Rb" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" class="wp-embedded-content"&gt;&lt;/iframe&gt;&lt;script&gt;
/**
 * WordPress inline HTML embed
 *
 * @since 4.4.0
 * @output wp-includes/js/wp-embed.js
 *
 * Single line comments should not be used since they will break
 * the script when inlined in get_post_embed_html(), specifically
 * when the comments are not stripped out due to SCRIPT_DEBUG
 * being turned on.
 */
(function ( window, document ) {
	'use strict';

	/* Abort for ancient browsers. */
	if ( ! document.querySelector || ! window.addEventListener || typeof URL === 'undefined' ) {
		return;
	}

	/** @namespace wp */
	window.wp = window.wp || {};

	/* Abort if script was already executed. */
	if ( !! window.wp.receiveEmbedMessage ) {
		return;
	}

	/**
	 * Receive embed message.
	 *
	 * @param {MessageEvent} e
	 */
	window.wp.receiveEmbedMessage = function( e ) {
		var data = e.data;

		/* Verify shape of message. */
		if (
			! ( data || data.secret || data.message || data.value ) ||
			/[^a-zA-Z0-9]/.test( data.secret )
		) {
			return;
		}

		var iframes = document.querySelectorAll( 'iframe[data-secret="' + data.secret + '"]' ),
			blockquotes = document.querySelectorAll( 'blockquote[data-secret="' + data.secret + '"]' ),
			allowedProtocols = new RegExp( '^https?:$', 'i' ),
			i, source, height, sourceURL, targetURL;

		for ( i = 0; i &lt; blockquotes.length; i++ ) {
			blockquotes[ i ].style.display = 'none';
		}

		for ( i = 0; i &lt; iframes.length; i++ ) {
			source = iframes[ i ];

			if ( e.source !== source.contentWindow ) {
				continue;
			}

			source.removeAttribute( 'style' );

			if ( 'height' === data.message ) {
				/* Resize the iframe on request. */
				height = parseInt( data.value, 10 );
				if ( height &gt; 1000 ) {
					height = 1000;
				} else if ( ~~height &lt; 200 ) {
					height = 200;
				}

				source.height = height;
			} else if ( 'link' === data.message ) {
				/* Link to a specific URL on request. */
				sourceURL = new URL( source.getAttribute( 'src' ) );
				targetURL = new URL( data.value );

				if (
					allowedProtocols.test( targetURL.protocol ) &amp;&amp;
					targetURL.host === sourceURL.host &amp;&amp;
					document.activeElement === source
				) {
					window.top.location.href = data.value;
				}
			}
		}
	};

	function onLoad() {
		var iframes = document.querySelectorAll( 'iframe.wp-embedded-content' ),
			i, source, secret;

		for ( i = 0; i &lt; iframes.length; i++ ) {
			/** @var {IframeElement} */
			source = iframes[ i ];

			secret = source.getAttribute( 'data-secret' );
			if ( ! secret ) {
				/* Add secret to iframe */
				secret = Math.random().toString( 36 ).substring( 2, 12 );
				source.src += '#?secret=' + secret;
				source.setAttribute( 'data-secret', secret );
			}

			/*
			 * Let post embed window know that the parent is ready for receiving the height message, in case the iframe
			 * loaded before wp-embed.js was loaded. When the ready message is received by the post embed window, the
			 * window will then (re-)send the height message right away.
			 */
			source.contentWindow.postMessage( {
				message: 'ready',
				secret: secret
			}, '*' );
		}
	}

	window.addEventListener( 'message', window.wp.receiveEmbedMessage, false );
	document.addEventListener( 'DOMContentLoaded', onLoad, false );
})( window, document );
//# sourceURL=https://dockerpros.com/wp-includes/js/wp-embed.js
&lt;/script&gt;</html><thumbnail_url>https://dockerpros.com/wp-content/uploads/2024/07/docker-stack-up_1137.jpg</thumbnail_url><thumbnail_width>800</thumbnail_width><thumbnail_height>600</thumbnail_height><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.</description></oembed>
