Docker compose version is obsolete

Docker logo
Docker

Introduction

Docker compose is widely used as the method to easily deploy docker applications. Docker compose uses .yaml or .yml files to declare the configuration. Previously this .yaml or .yml file included a “version:” statement. This “version:” statement is now obsolete. More info can be found on the Docker Compose Github.

When running docker compose up -d with a docker-compose.yml file that includes “version:” it will generate a warning. This warning does not impact the Docker application but will clutter on the terminal when running multiple docker compose stacks.

root@auth01:/opt/docker/authentik# docker compose up -d
WARN[0000] /opt/docker/authentik/docker-compose.yml: `version` is obsolete 

How to fix

Fixing this warning is easy. Just remove the “version:” line from the docker-compose.yml. This can be easily achieved with the following command. Remember to always backup your configuration before running the command:

sed -i '/^version:/d' docker-compose.yml

Conclusion

Next time you run docker compose up -d the warning will be gone.

Leave a Reply

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