Docker Compose v2 and Profiles Are the Best Thing Ever

preview_player
Показать описание
Containers start / stop faster and profiles let you start specific services in different environments.

Hit the subscribe button to receive more videos like this!

REFERENCE LINKS
---------------------------------------------------

COURSES
---------------------------------------------------
Courses I've created that focus on web dev and deployment topics.

THE TOOLS I USE / GEAR
---------------------------------------------------

FOLLOW ME ELSEWHERE
---------------------------------------------------

TIMESTAMPS
---------------------------------------------------
0:00 -- Intro
0:29 -- Docker's timeline for Docker Compose v2
2:46 -- Going over the example Flask app
3:46 -- The difference between how v1 and v2 runs
4:32 -- Checking out how Docker Compose profiles work
7:03 -- The profile flag vs using the COMPOSE_PROFILES env variable
8:03 -- v2 starts and stops containers a bit faster than v1
9:39 -- The env var approach makes it easy to control which services to run
13:28 -- The profile command line flag applies to all compose commands
14:21 -- You can easily split up your services onto multiple servers
Рекомендации по теме
Комментарии
Автор

Nice! I was trying to find a way to compose up only 3 of 5 containers in my dev environment using V1, but luckely I've found this solution with profiles in V2)) Thanks

sanlobach
Автор

I'm curious why you decided to not use the more "grouping" dev, staging, prod namespaces instead?
In this way is possible to run `docker compose --profile dev up` instead of `docker compose --profile postgres, redis, assets, web, worker, cable up` (or specify just "dev" instead of "postgres, redis, assets, web, worker, cable" in the COMPOSE_PROFILES env var)

FrancescoMari
Автор

specifying multiple profiles as part of the `docker compose up --profiles` doesn't seem to work.

danleyb
Автор

How can one ignore the profiles then run a compose command on all services?

danleyb