The warning indicates that the version
attribute in your docker-compose.yml
file is no longer necessary and is being ignored. Starting from Docker Compose v2.0, the version
field is considered obsolete, and its presence does not affect the behavior of your Compose file.
Steps to Resolve
-
Open your
docker-compose.yml
file in a text editor. -
Remove the
version
field entirely. For example, if your file looks like this:yaml
version: "3.8" services: app: image: my-app ports: - "8080:80"
Update it to:
yaml
services: app: image: my-app ports: - "8080:80"
-
Save the file and rerun the
docker compose up -d
command.
Why It Happens
The version
field was used in earlier versions of Docker Compose to specify the schema version of the Compose file. As Docker Compose has matured, it now auto-detects and uses the correct schema based on the features in your Compose file.
This warning is just informational and does not affect the operation of your containers. Removing the version
field will eliminate the warning.