Click to have a surprise
With the stack YAML file defined, the application can be deployed through the Docker stack deploy command.
Docker will create the various resources according to the YAML content. In order to not duplicate the name, all resources will be prefixed with the stack names, and we are here wpstack_*.
After deployment is complete, you can view the status of various resources through related commands.
If you want to update some of the properties of the stack, modify the YAML file directly, and then redeploy it. For example, the WordPress port from 8000 to 8888.
Execute the Docker stack deploy command again.
Stack update succeeded. Check the service wpstack_wordpress to confirm that the port has been updated to 8888:
To update the port, Swarm started a new wpstack_wordpress container that had been shutdown before.
It is also easy to remove the stack:
Click to have a surprise