1

Disabling services with Docker profiles

 2 months ago
source link: https://intodot.net/disabling-services-with-docker-profiles/?utm_campaign=disabling-services-with-docker-profiles
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

19 Mar, 2024

Disabling services with Docker profiles

Docker-Logo-1024x576.png

Docker Compose allows us to easily start multiple containers at the same time, saving us from starting them all manually. However, as your project grows, you might realize that you don’t always need all services to develop or test your application. By using profiles, you can easily customize your compose file for different environments or uses.

Show me the code

In this example, we are upgrading the docker-compose.yaml from our previous article. We will put the services geoserver-db and geoserver-db into a separate profile. The reason for that is that since we are not always working with maps, we can improve the initialization time of our containers a bit, and also save on performance if we are not running GeoServer. To accomplish that, all we need to do is add the profiles attribute in the services that we do not always want to start.

So now if I were to start my containers simply with “docker compose up -d”, it would only start Kibana, Elasticsearch, and the setup service. That’s because services without a profile are always started (or stopped). Then in case I wanted to start everything, I’d just need to specify the profile in the command, like this: “docker compose –profile maps up -d”.


19 Mar, 2024

One thought on “Disabling services with Docker profiles”

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Comment *

Name *

Email *

Website

Save my name, email, and website in this browser for the next time I comment.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK