Introduction to Docker Swarm | Tutorial for Beginners | Examples | Typical Tasks
Вставка
- Опубліковано 4 жов 2024
- In this Docker Swarm tutorial we’ll build the basic Swarm skills that you’ll need in your project work. You’ll learn to set up a Swarm cluster, Deploy applications, explore and manage your stack in the cluster, and we’ll also go through typical maintenance activities that you’ll need.
You can find the article form of this tutorial on my blog here: takacsmark.com...
This is a code-along tutorial, so please open up your terminal and get ready. We’ll use a two step approach:
We’ll set up a cluster and deploy an application first. The goal here is to show you what Swarm is all about and what it’s capable of. We’ll set up a one machine cluster on your local machine first, and then we’ll set up a cluster of two hosts.
Once you get the big picture in step 1, I’ll explain all details behind. I think it’s easier to learn and understand after you’ve seen the stuff in action.
In order to get the most out of this article you should be familiar with basic Docker concepts, like containers, images, the Dockerfile and Docker Compose. If you need a refresher on these topics, please go to my previous tutorials first. Alternatively you can get my book for a complete guided experience.
I hate it when I find such a great channel that seems to be dead. You should really consider making more content. Your style of teaching is amazing
I bedanke mich fùr Ihre Helfe. Sie sind sehr hilfsbereit.
I have been using standalone docker for a while, merely as an alternative to virtualization. Now, upgrading all our dedicated servers in the cloud, and thought it was a good time to learn about swarm and build them in a highly available and scalable way. I understood the concept from your talk. Thank You so much.
Awesome tutorial. Thank you sir
This is a good talk, but maybe you could continue this with explaining how to manage swarm in production, and how to automate deployments from push to server.
wonderful tutorial!!.standing ovation to you sir
God bless you Mark, for creating such an amazing videos- which are far better than the paid tutorials that I have purchased online
Thanks! :)
Fantastic explantation in just enough time. Thank you sir!
I'm just at the middle of the video and it's so well explained and interresting !!! THANKS
great tutorial, really searched a lot to get this. Thanks a lot. JazakAllah
Kudos! This is great tutorial
Great explanation..thankyou
one of the best tutorial video's on docker..., awesome stuff.
I found you use vim and emacs org mode, that's so cool
you are the only one youtuber that not use vscode or sublime :D
Great video on docker swarm. As a beginner I really understood the concept.thank you
Thank you! Really enjoyed your tutorial! Currently need to do some docker swarm stuff for some customer :)
Thank you. Best tutorial that I have seen for the docker swarm. \o/
Nice tutorial . I understand swarm. In the last you comment on kubernetes . would you please upload kubernetes tutorial near future :)
Thanks again for uploading this tutorial .
very good explonation sir.
This is really great and well put up. Cleared a lot of my queries on docker swarm.
Nice explanation. Many thanks.
This tutorial is absolutely amazing. I've subscribed and looking forward for more of your videos. I'd like to give some feedback after I've got the hang of Docker swarm and deployed my application there. The video is great but missing few tiny definitions to make it perfect for beginners in my opinion, and I feel it would have been nice if you included:
What docker registry is and how to create a repository on docker hub (many beginners might face errors when trying to push an image locally not knowing that they need to create a repo). It could be useful to show how to store the image on local registry container too. Maybe a little example of how to automate the process by providing a yaml definition.. and so on.
Thanks for your efforts putting together this amazing video. Overall, this is the best video I have found on the internet.
Thanks Muhammad for your kind feedback and the tips!
I did my own private registry, was a bit of a pain but got it working eventually. His solution of using the docker hub seems more simple and elegant, would also like to see how that is done.
Great Tutorial with good examples...
Thank you mark, i watched all ur docker's videos and they were fantastic and helped me so much in my daily work, hope you keep posting such a great contents 🙂
Excellent video. Filled in a few gaps I was having with docker swarm. Kinda shocking the manual stuff that needs to be done to get the containers back on a down host though. I had found this myself and was hoping that this video would give some magic about how the containers could magically come back. Apparently not. In my testing, if I rebooted one of the machines , all the containers would move nicely to the other, but never come back. I can see why people use Kubernetes. 🙂
great content, thanks
thanks for your time. really cleared some things for me :)
What a great tutorial mark, thank you!, auto subscribe :)
Thank you! This was a great demo. I've been trying to understand the different parts of Docker and how they all relate. Your demonstration helped clear up a lot of confusion.
you all prolly dont give a damn but does anybody know a trick to log back into an instagram account..?
I was dumb lost my login password. I appreciate any assistance you can give me
@Houston Lochlan instablaster =)
@Daniel Lance I really appreciate your reply. I got to the site through google and I'm in the hacking process now.
I see it takes a while so I will get back to you later with my results.
@Daniel Lance it did the trick and I actually got access to my account again. I'm so happy:D
Thank you so much, you saved my account !
@Houston Lochlan you are welcome :D
Mark. We meet again! :)
Great vid!
You are the best
Good job Sir, thanks.
Fantastic explanation ! thank you :)
Very nice content put together. Clear and concise throughout, thanks a lot Mark for your amazing effort and for sharing your knowledge.
Great class
Nice content! Thumbs up to your channel.
Awesome video... Anw, can docker swarm handle stateful app, like postgres ? 🙏
good explain :)
Great video, thank you sir!
Mindig öröm egy magyar kollégától tanulni! :)
great . can you make a tutorial about distributed volume in cluster or swarm ?
Great content, if you could improve the sound recording in the future would be superb.
Thanks Alan, you are right, I already installed a new microphone desk arm, it sounds great, the next video will be much better.
Really like you video! Thanks!
Clean your ears
Hi @@graysonorr8172 , thanks for your support, Alan was actually right, I can do better audio than this and I will. So for the next video we shall all clean our ears and listen to the magic :)
This is a great tutorial! Thank you for sharing!
Is there downtime when you force update services to redistribute Tasks?
what a great tutorial, i have been taking an online devops course, and you are explaining way more better,
if you may i have a question and i would like you see your suggestions, because i did not try this and i searched about it , but from an experianced person, advise is very priceless,
Question :
How can i synchronize multiple database containers for their data persistent, i mean all of these containers should have a shared volume of data , am i correct ?
if you have an advise ( as best practice ) i would really appreciate yours.
Much Respect.
Thank you.
perhaps what you need is replication, start your research from there
I am using windows 10 and docker-machine is not recongnized as internal or external command. what need to be installed to get docker-machine cmd working in my case ?
thanks so muchhh
hi, nice video do you have a docker course on udemy?
Where can I find your vimrc?
Thank you, great introduction.
One thing I don't get: Why would you run multiple replicas of one service on the same node? On different nodes it would load balance over multiple physical machines resulting in more power (supposed the nodes are not VMs on one host). But multiple replicas on the same host does not give you more power, does it?
im quite sure what you say is the end goal but for learning this is easier (you wont have to buy more computers for home : D) also compose only works on a single host device but it still has option to run multiple of the same container so there must be a demand for it
I too was curious so went searching for the answer which is ... If one of your containers goes down it will get restarted which could take seconds to minutes. During this restart period you still have another 1 or 2 replicas serving responses. But .. as you say, if this is a swarm, it should go to a replica on another host. I guess if the container does a blocking kind of long running action, multiple replicas would help also if routed correctly.
Could you please share the yaml location in github?
Hi Adreas,I have created nginx image using stack.I want to add one file in image using stack.Using config and volume we can add file in image.Can you give other method to add file in container using stack
Hi Ankit, have a look at my Dockerfile videos, those videos get you started with your custom images.
Thanx for reply.I seen video.I have created file using volume in stack.But I am asking different way to create file inside container without volume
Hi.. Love the video. I want to follow the steps in the video but I'm stuck at creating the docker machine. The console stuck at "Waiting for SSH to be available". I've tried running the command as Admin and also tried running it on Git Bash but it did not help. I'm using Docker Desktop for Windows and Hyper-V. Can someone help me?
Hi, I have not met this issue, so I cannot advise from experience. I found this on Stackoverflow stackoverflow.com/questions/40391389/docker-stuck-on-waiting-for-ssh-to-be-available, have you already tried this?
@@takacsmark yup.. still the same problem..
I can't solve the specific problem, I'm afraid, but I can help you proceed with the training :) Just go to labs.play-with-docker.com/ and start up two machines and you're ready set up your Swarm. Hope this helps.
@@takacsmark thanks! I have another question. I can use labels in the constraints but can I use it in the environment (in docker-compose.yml) as well?
I ran the command as you mentioned:
docker stack deploy -c docker-compose.yml nodeapp
I got the error:
yaml: line 5: found character that cannot start any token
So I checked in my docker-compose.yml file which is the same as yours:
version: '3'
services:
web:
build: .
image: takacsmark/swarm-example:1.0
ports:
- 80:3000
networks:
- mynet
db:
image: mongo:4.0.3
networks:
- mynet
networks:
mynet:
In my current folder, I only have Dockerfile, docker-compose.yml & server.js files
So any suggestion on this error?
I installed the dpcker-compose and also gave permissions but now when I run the docker-compose build, I get this error:
ERROR: yaml.scanner.ScannerError: while scanning for the next token
found character '\t' that cannot start any token
in "./../docker-compose.yml", line 5, column 1
Hi Arijit, it seems that your line starts with a tab. Please make sure that you use a text editor that reliably uses spaces at the beginning of the line. You can set any popular code editor to use spaces. I think visual studio code is an easy and popular option.
@@takacsmark Thank you! I fixed that. I had used tabs. I fixed it by using spaces.
docker-compose push(ERROR: denied: requested access to the resource is denied)
docker stack deploy nodeapp -c docker-compose.yml( Error : this node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again
don't work for me in Step : Set up a cluster with multiple hosts
the problem was : i must execute all my command in Root priviliege
1:25 in and already thumb'd.
Thanks for the good explanation, docker-machine (ua-cam.com/video/3-7gZS4ePak/v-deo.html) is deprecated so how can we use the same
Brother buy a microphone to make your channel better I love the channel but your audio can improve :) Thank you for aall the videos.
Yet another guide which does not work on windows...