From the course: Docker for Developers: Create and Manage Docker Containers
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Deploy and manage a service - Docker Tutorial
From the course: Docker for Developers: Create and Manage Docker Containers
Deploy and manage a service
- [Narrator] We've already talked about Docker Compose, and we have a compose.yml file which we can reuse for Swarm mode. Let's walk through creating and running a simple app using Docker Swarm. In our compose.yml file, we define two services, app and db. Both services will need to run in Swarm mode in order for our app to work. If we were using Docker Compose, we would use the Docker Compose up command to run our app. For Swarm, type docker stack deploy. Then type the -c flag, the name of our Compose file, which is compose.yml, and the name of our stack. I'll set it to myapp. Think of a stack as a group of services defined in your Compose file. Docker Swarm uses the stack name to organize and manage those services. Ah, we have an error. The custom network that we created earlier cannot be used in Swarm mode. We created a custom bridge network, but that network type can't be used in Swarm. Let's go back to…