Docker
/Beginner
Services
Definition
The top-level concept in a Docker Compose file. A 'service' defines a computing component of an application, prescribing which image to use, how many container instances to run, and its configuration.
Explain Like I'm New
The individual 'Apps' inside the compose file. A database is one service. The API is another service.
Real World Example
In the command `docker-compose restart api`, the word 'api' refers to the specific Service block defined in the YAML file. Compose will only restart the containers associated with that specific service.
Common Use Cases
- •Application architecture
- •Targeted commands
Interview Questions
basic
- Can one Compose 'Service' actually spin up multiple identical containers simultaneously?
intermediate
- What happens if you run `docker-compose up --scale api=3`?