Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can all docker swarm instances run on same machine?

I have a couple of Docker swarm questions (Sorry for not splitting them up but they are all closely related):

  • Do all instances in a swarm have to run on different machines or can they all run on the same? (if having limited amount of hardware and just wanting to try swarm mode)
  • Do I have to run swarm mode to be able to communicate between instances?
  • What is the key difference between swarm mode and just running a number of containers as regular?
  • What are the options of communication between instances of containers? (in swarm and in regular mode) http? named pipes? other?
  • If using http communication between containers on same machine, will it be roughly similarly as fast as named pipes?
  • Is there any built in support for a message bus or similar in Docker?
  • Is there support for any consensus protocol in Docker?
  • Are there any GUI's for designing, managing, testing and/or debugging Docker swarms?
  • Can a container list other containers, stop/restart some and start new ones? (to be able to function as a manager for other containers)
  • Can a container be given access to OS-features (Linux in my case) to configure for instance a reverse proxy or port forwarding on the WAN?

Background: What I'm trying to figure out is how I should go about and build a micro service mesh using Docker. The containers will be running .NET Core. I'm not too keen on relying too much on specifically Docker since it may not be the preferred tech in a couple of years. What can/should I do with Docker and what can/should I do inside the containers. That's what I'm trying to figure out.

like image 973
Andreas Zita Avatar asked Jun 16 '18 18:06

Andreas Zita


People also ask

What's new in Docker Swarm?

Any new feature in docker gets native support in swarm. Docker swarm can create multiple instances of an application. It can be scaled up or down depending on the need. The swarm is represented as one host machine and any service running on any swarm machine can be invoked by using the master node.

What is the difference between standalone containers and swarm services?

When Docker is running in swarm mode, you can still run standalone containers on any of the Docker hosts participating in the swarm, as well as swarm services. A key difference between standalone containers and swarm services is that only swarm managers can manage a swarm, while standalone containers can be started on any daemon.

Can I run two instances of Docker on the same machine?

You can’t run two instances of application (in your case Docker) on same machine. This is how Linux & Docker is built and nothing you can change. But there is workaround.

Does podman support one-machine Docker Swarm?

I don’t even use a one-machine Docker Swarm. I use docker-compose. And that’s just not something that Podman is ever going to officially support. This makes sense because Red Hat is thinking enterprise.


1 Answers

I've copied your questions and tried to answer them.

  • Do all instances in a swarm have to run on different machines or can they all run on the same? (if having limited amount of hardware and just wanting to try swarm mode)
    • You can have only one machine in a swarm and run multiple tasks of the same service or in other words your scale of a service can be more than the number of actual machines. I have a testing swarm with a single machine and one with three and it works the same way.
  • Do I have to run swarm mode to be able to communicate between instances?
    • You have to run your docker in swarm mode in order to create a service, please see this link
  • What is the key difference between swarm mode and just running a number of containers as regular?
    • The key difference afaik is, that when a task goes down, docker puts another task up automatically. And you can easily scale your services, which means you can easily have multiple tasks just by scaling your service (up or down). As of running a container - when it goes down you have to manually start another.
  • What are the options of communication between instances of containers? (in swarm and in regular mode) http? named pipes? other?
    • I've currently only tested with a couple of wildfly servers in a swarm, which are on the same network. I'm not sure about others, but would love to find out. I've only read about RabbitMQ, but can't seem to find the link atm.
  • If using http communication between containers on same machine, will it be roughly similarly as fast as named pipes?
    • I can't say.
  • Is there any built in support for a message bus or similar in Docker?
    • I can't say.
  • Are there any GUI's for designing, managing, testing and/or debugging Docker swarms?
    • I've tested rancher and portainer.io, for a list of them I found this link
  • Can a container list other containers, stop/restart some and start new ones?
    • I'm not sure why would you want to do that? And I guess it's possible, see this link
  • Can a container be given access to OS-features (Linux in my case) to configure for instance a reverse proxy or port forwarding on the WAN?
    • I can't say.
like image 72
namokarm Avatar answered Nov 15 '22 03:11

namokarm