The 'Version in docker-compose.yml is unsupported' error occurs when your Docker Compose file specifies a version number that your installed docker-compose tool doesn't recognize. This is typically resolved by upgrading Docker Compose, removing the version field entirely (for Compose V2), or lowering the version number.
The "Version in docker-compose.yml is unsupported" error indicates a mismatch between the `version:` field in your Compose file and what your installed Docker Compose understands. Docker Compose files historically required a `version:` declaration at the top (like `version: "3.8"`) to specify which features the file uses. Different versions of the docker-compose tool support different version ranges: - docker-compose 1.17.x supports up to version 3.4 - docker-compose 1.18.x supports version 3.5 - docker-compose 1.24.x supports version 3.7 - docker-compose 1.27+ supports version 3.8 **Important change**: Starting with Docker Compose V2 (the `docker compose` command without the hyphen), the `version:` field is now obsolete. Compose V2 automatically uses the latest schema and ignores the version field - in fact, including it triggers a deprecation warning. This error most commonly appears when: 1. You're using an older docker-compose installation that doesn't support newer version numbers 2. Your Compose file specifies a version that doesn't exist (like "3.9" in some older docs) 3. There's a syntax issue with the version field itself
First, determine which version of Docker Compose you have installed:
# Check the old standalone tool
docker-compose --version
# Check Docker Compose V2 (plugin)
docker compose versionCompare the output to the version in your docker-compose.yml. Common version support:
| docker-compose version | Max Compose file version |
|----------------------|-------------------------|
| 1.17.x | 3.4 |
| 1.18.x - 1.20.x | 3.5 |
| 1.21.x - 1.23.x | 3.6 |
| 1.24.x - 1.26.x | 3.7 |
| 1.27.x+ | 3.8 |
| V2 (docker compose) | No version required |
If you're using Docker Compose V2, you should see output like Docker Compose version v2.x.x.
If you're using Docker Compose V2 (the modern docker compose plugin), simply remove the version: line from your docker-compose.yml:
Before:
version: "3.8"
services:
web:
image: nginxAfter:
services:
web:
image: nginxStarting with Compose V2, the version field is obsolete. Docker now uses the most recent schema automatically and validates your file based on what features you actually use.
After removing the version line, run:
docker compose upNote the space between docker and compose - this is the V2 syntax.
If you need to support the version field or prefer using the older syntax, upgrade Docker Compose:
On Linux (install V2 as plugin):
# Remove old standalone docker-compose
sudo apt-get remove docker-compose
# Install Docker Compose plugin (V2)
sudo apt-get update
sudo apt-get install docker-compose-plugin
# Verify installation
docker compose versionAlternative: Install latest standalone docker-compose:
# Download latest version
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
# Make executable
sudo chmod +x /usr/local/bin/docker-compose
# Clear shell cache
hash -r
# Verify
docker-compose --versionOn macOS/Windows:
Update Docker Desktop to the latest version. Docker Compose V2 is included.
If you cannot upgrade Docker Compose, lower the version in your Compose file to match what your installation supports:
# Change from unsupported version
version: "3.8"
# To a supported version (check your docker-compose version)
version: "3.4"Common safe version choices:
- version: "3" - Equivalent to 3.0, works with most installations
- version: "2.4" - Stable, good for development (has depends_on with healthcheck)
- version: "3.4" - Works with docker-compose 1.17+
Note: Lowering the version may disable features you're using. Check the [Compose file version differences](https://docs.docker.com/compose/compose-file/compose-versioning/) to understand what features each version supports.
The version field is sensitive to formatting. Ensure you're using standard double quotes:
Wrong - Smart quotes (from copy-paste):
version: "3.8" # These are curly/smart quotesWrong - Missing quotes:
version: 3.8 # Will be parsed as float, not stringCorrect:
version: "3.8" # Standard double quotes
version: '3.8' # Single quotes also workTo find hidden characters, check your file in a hex editor or run:
cat -A docker-compose.yml | head -5If you see unusual characters around the quotes, retype the line manually.
If you have both old docker-compose and new Docker Compose V2 installed, switch to the new command:
# Old command (standalone python tool - deprecated)
docker-compose up
# New command (Docker plugin - recommended)
docker compose upDocker Compose V2 is built into Docker and handles version fields more gracefully. It will accept any valid version string and automatically use the latest features available.
To check if V2 is available:
docker compose versionIf you see version 2.x output, you have V2 installed and should use docker compose going forward.
After upgrading docker-compose, your shell might still point to the old binary. Clear the cache:
# Bash/Zsh
hash -r
# Or specifically for docker-compose
hash -d docker-composeThen verify you're using the new version:
which docker-compose
docker-compose --versionIf the old version still appears, check your PATH for multiple installations:
# Find all docker-compose binaries
which -a docker-compose
# Or search common locations
ls -la /usr/local/bin/docker-compose /usr/bin/docker-compose 2>/dev/nullRemove or rename any old binaries that appear before the new one in your PATH.
### Understanding Compose File Versions
The version: field in docker-compose.yml evolved through several generations:
Version 1 (legacy): No version field. Simple key-value syntax without services block.
Version 2.x: Introduced services:, networks:, volumes: top-level keys. Added features like depends_on with health checks.
Version 3.x: Designed for Docker Swarm compatibility. Some version 2 features (like resource limits in non-swarm mode) were changed.
Compose Specification (current): The version field is obsolete. Docker Compose V2 uses the Compose Specification which is versioned separately from the tool.
### Compose V2 Migration
Docker deprecated the standalone docker-compose Python tool in favor of docker compose (a Go-based plugin). Key differences:
| Feature | docker-compose (V1) | docker compose (V2) |
|---------|--------------------|--------------------|
| Version field | Required | Optional (obsolete) |
| Command | docker-compose | docker compose |
| Install | Separate | Included with Docker |
| Language | Python | Go |
### CI/CD Considerations
In CI/CD pipelines, you may encounter this error due to different docker-compose versions across environments. Solutions:
1. Pin the version: Install a specific docker-compose version in your CI config
2. Remove version field: Use versionless Compose files with docker compose
3. Use lowest common version: Specify a version all environments support
Example GitHub Actions workflow:
- name: Setup Docker Compose
run: |
docker compose version || \
(curl -L "https://github.com/docker/compose/releases/download/v2.24.0/docker-compose-linux-x86_64" -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose)### The "3.9" Version Myth
Some older documentation references version: "3.9", but this version was never officially released for the original Compose file format. If you see this in a tutorial, use version: "3.8" or remove the version field entirely when using Compose V2.
### Compatibility Matrix
For reference, here's the Docker Engine requirement for each Compose file version:
| Compose file version | Docker Engine |
|---------------------|---------------|
| 3.8 | 19.03.0+ |
| 3.7 | 18.06.0+ |
| 3.6 | 18.02.0+ |
| 3.5 | 17.12.0+ |
| 3.4 | 17.09.0+ |
| 3.3 | 17.06.0+ |
| 2.4 | 17.12.0+ |
dockerfile parse error line 5: unknown instruction: RRUN
How to fix 'unknown instruction' Dockerfile parse error in Docker
Error response from daemon: manifest for nginx:nonexistent not found: manifest unknown: manifest unknown
How to fix 'manifest for image:tag not found' in Docker
Error response from daemon: invalid reference format: repository name must be lowercase
How to fix 'repository name must be lowercase' in Docker
Error response from daemon: No such image
How to fix 'No such image' in Docker
Error response from daemon: Container is not running
How to fix 'Container is not running' when using docker exec