Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do service and container mean the same thing?

Tags:

docker

I have come across the word service in many Docker documentations. Does service mean a container? By definition, a container is supposed to perform only one task. Are service and container then to be understood as synonymous?

like image 986
SharePointNewbie Avatar asked Dec 09 '25 07:12

SharePointNewbie


1 Answers

The term "service" is originally linked with Docker Swarm

A service is the definition of the tasks to execute on the manager or worker nodes.
It is the central structure of the swarm system and the primary root of user interaction with the swarm.

When you create a service, you specify which container image to use and which commands to execute inside running containers.

As mentioned in the Container Network Model:

Endpoint represents a Service Endpoint. It provides the connectivity for services exposed by a container in a network with other services provided by other containers in the network.

Since Endpoint represents a Service and not necessarily a particular container, Endpoint has a global scope within a cluster.

That illustrates a service is not a container, but a way to describe and manage a set of containers (0 to n).
From "How services work":

https://docs.docker.com/engine/swarm/images/services-diagram.png

like image 139
VonC Avatar answered Dec 11 '25 23:12

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!