What if i have docker image build on my local machine (manager node) and i want to run this image in swarm mode but other worker nodes don’t have this image, so do i need to create image on that node as well.
Deployments in swarm mode are done using a yaml file. So, if you have built the image locally and you want to run this image in swarm mode:
Push the image to any of the container registry you are using. Mostly Docker hub.
Create a deployment file like docker-compose.yml and mention the image in it.
Deploy the stack.
You can not run locally built images on other nodes. Swarm is responsible for maintaining the state defined in the docker-compose.yml file.
Seeing the popularity of YAML in various DevOps tools. I have recently published a course covering the syntax on YAML data serialization format and its key features. You can access this here -> https://www.educative.io/courses/introduction-to-yaml/