Home Explore Blog CI



docker

3rd chunk of `content/guides/swarm-deploy.md`
a5ae71aec303ad462387387dd1dd2279b2c3383c356a5bfb0000000100000c35
> **Kubernetes Services and Swarm Services are very different**
>
> Despite the similar name, the two orchestrators mean very different things by
> the term 'service'. In Swarm, a service provides both scheduling and
> networking facilities, creating containers and providing tools for routing
> traffic to them. In Kubernetes, scheduling and networking are handled
> separately, deployments (or other controllers) handle the scheduling of
> containers as pods, while services are responsible only for adding
> networking features to those pods.

## Deploy and check your application

1. Deploy your application to Swarm:

   ```console
   $ docker stack deploy -c bb-stack.yaml demo
   ```

   If all goes well, Swarm will report creating all your stack objects with no complaints:

   ```shell
   Creating network demo_default
   Creating service demo_bb-app
   ```

   Notice that in addition to your service, Swarm also creates a Docker network by default to isolate the containers deployed as part of your stack.

2. Make sure everything worked by listing your service:

   ```console
   $ docker service ls
   ```

   If all has gone well, your service will report with 1/1 of its replicas created:

   ```shell
   ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
   il7elwunymbs        demo_bb-app         replicated          1/1                 getting-started:latest   *:8000->3000/tcp
   ```

   This indicates 1/1 containers you asked for as part of your services are up and running. Also, you see that port 8000 on your development machine is getting forwarded to port 3000 in your getting-started container.

3. Open a browser and visit your Todo app at `localhost:8000`; you should see your Todo application, the same as when you ran it as a stand-alone container in [Part 2](02_our_app.md) of the tutorial.

4. Once satisfied, tear down your application:

   ```console
   $ docker stack rm demo
   ```

## Conclusion

At this point, you've successfully used Docker Desktop to deploy your application to a fully-featured Swarm environment on your development machine. You can now add other components to your app and taking advantage of all the features and power of Swarm, right on your own machine.

In addition to deploying to Swarm, you've also described your application as a stack file. This simple text file contains everything you need to create your application in a running state; you can check it in to version control and share it with your colleagues, letting you to distribute your applications to other clusters (like the testing and production clusters that probably come after your development environments).

## Swarm and CLI references

Further documentation for all new Swarm objects and CLI commands used in this article are available here:

- [Swarm Mode](/manuals/engine/swarm/_index.md)
- [Swarm Mode Services](/manuals/engine/swarm/how-swarm-mode-works/services.md)
- [Swarm Stacks](/manuals/engine/swarm/stack-deploy.md)
- [`docker stack *`](/reference/cli/docker/stack/)
- [`docker service *`](/reference/cli/docker/service/)

Title: Verifying and Tearing Down the Application on Docker Swarm
Summary
This section details how to verify that the application has been successfully deployed to Docker Swarm. The 'docker service ls' command is used to check the status of the service, ensuring that the specified replicas are running and the port forwarding is correctly configured. Users are instructed to access the application in a browser to confirm functionality. Finally, the section explains how to tear down the application using the 'docker stack rm' command and highlights the benefits of using stack files for version control and application distribution, along with providing links to further Swarm and CLI references.