Service Version Meaning

Hi All,

I apologize for such a basic or noob question, but I’m not able to find the answer via the normal resources and usually receive a response related the version of docker I am running as opposed to the service.

**Ultimate Goal **
To have one docker compose file that includes all the services I want to run on a Unbuntu Server.

Question How does the version work when specified in the docker-compose file? In the below case, version 3.


I have seen different services have a different version listed in an example docker-compose file (e.g. Plex uses version: ‘3.7’ while pi-hole uses version: ‘3.0’)

Trying to understand how the version impacts my ability to achieve the ultimate goal of having one docker-compose file instead of many

Docker Compose v1 required version numbers but it is not required anymore in case of Docker Compose v2 which you should use as Compose v1 will be discontinued in months. The version number was for the supported parameters in a compose file. Different versions supported different parameters in the YAMl. Now we have “Compose file specification”

I don’t think that is a good idea, but it has nothing to do with the version numbers. Use one compose file for one project. If you have many services, using one compose would become hard to maintain.

1 Like

It is the version of the compose file schema.

It does influence which configuration elements can be used and are valid when the compose file is validated against the schema version.

version: '3' used to be interpreted as version: '3.0', but with recent docker compose v2 versions (the cli plugin, not the compose file schema), it is interpreted as latest version: '3.x'.

Generally the version became optional with docker compose v2 (the cli plugin), because it uses the most recent compose file schema version anyway.

Though, old versions of docker-compose (v1, deprecated) require the schema version. If you still use docker-compose (v1) and not docker compose (v2), then I highly suggest to uninstall v1 and install v2.

Update: @rimelek already responded without that I realized it, while I was typing.

Thanks for the feedback @meyay and @rimelek !