docker-compose answers with line 1: Not: command not found
Fix it fast
Most common cause, 1 of 2The URL asks for an OS or CPU name that Compose does not publish
Remove the broken file and download the asset whose name appears in the release list for your CPU.
sudo rm /usr/local/bin/docker-compose
VERSION=v5.8.0
ARCH=armv7 # pick one: x86_64 aarch64 armv7 armv6 ppc64le riscv64 s390x
sudo curl -fSL "https://github.com/docker/compose/releases/download/${VERSION}/docker-compose-linux-${ARCH}" \
-o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-composeShort answer
/usr/local/bin/docker-compose: line 1: Not: command not found means the file holds the text Not Found instead of a program: curl saved GitHub's 404 page from a release URL that does not exist. Delete it and download the exact asset name (lowercase linux, armv7 not armv7l, a v before the version) with curl -f, or install docker-compose-plugin. Compose v2 to v5.8.
Which cause do you have?
Look at what the file contains and how big it is, then print the names your download command filled in. A file only a few bytes long that reads Not Found confirms a failed download; comparing the uname output and your URL with the release's asset list shows which part of the name was wrong.
head -c 100 /usr/local/bin/docker-compose; echo
ls -l /usr/local/bin/docker-compose
uname -s; uname -mThen find the line you see in this list and open its fix:
- 1The URL asks for an OS or CPU name that Compose does not publish
The URL you used contains Linux with a capital L, armv7l, arm64 or amd64, or it comes from an old 1.x guide written for a Raspberry Pi - 2The version part of the URL is not a real release tag
The OS and CPU part of the name match the asset list, but the version in the URL lacks its v, carries an extra v, or is a placeholder copied from a guide
What does the error look like?
/usr/local/bin/docker-compose: line 1: Not: command not founddocker-compose: line 1: Not: command not found
Cause 1 of 2
The URL asks for an OS or CPU name that Compose does not publish
You seeThe URL you used contains Linux with a capital L, armv7l, arm64 or amd64, or it comes from an old 1.x guide written for a Raspberry Pi
Check
A release URL that names a missing file gets an HTTP 404 Not Found answer from GitHub. curl treats that as a normal transfer unless --fail is given, so -o writes the error page into /usr/local/bin/docker-compose. After chmod +x, bash cannot execute the file as a program, runs it as a shell script instead, and fails on its first word, Not. Compose v5.8.0 publishes lowercase names only: docker-compose-linux- followed by aarch64, armv6, armv7, ppc64le, riscv64, s390x or x86_64. A command built from $(uname -s)-$(uname -m) gives a matching name only when both outputs are spelled exactly like that; Compose 1.29.2 used Linux-x86_64 and had no ARM build at all.
curl -sSL -o /dev/null -w '%{http_code}\n' https://github.com/docker/compose/releases/download/v5.8.0/docker-compose-linux-armv7Fix
Remove the broken file and download the asset whose name appears in the release list for your CPU. Add -f, so a wrong name makes curl stop with an error instead of saving a 404 page.
sudo rm /usr/local/bin/docker-compose
VERSION=v5.8.0
ARCH=armv7 # pick one: x86_64 aarch64 armv7 armv6 ppc64le riscv64 s390x
sudo curl -fSL "https://github.com/docker/compose/releases/download/${VERSION}/docker-compose-linux-${ARCH}" \
-o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-composeVerify
The file is now a real program, far larger than an error page, and the command prints the Compose version instead of a shell error.
ls -lh /usr/local/bin/docker-compose
docker-compose versionConfirmed by github.com
Cause 2 of 2
The version part of the URL is not a real release tag
You seeThe OS and CPU part of the name match the asset list, but the version in the URL lacks its v, carries an extra v, or is a placeholder copied from a guide
Check
Release tags changed form between Compose generations: the last 1.x release is tagged 1.29.2 with no v, while current releases are tagged like v5.8.0. A URL with 5.8.0, v1.29.2 or a literal placeholder points at a release that does not exist, and the result is the same Not Found file. Docker's own install pages tell you to substitute the version in their example URL, which makes this an easy slip.
curl -sSL -o /dev/null -w '%{http_code}\n' https://github.com/docker/compose/releases/download/5.8.0/docker-compose-linux-x86_64
curl -sSL -o /dev/null -w '%{http_code}\n' https://github.com/docker/compose/releases/download/v5.8.0/docker-compose-linux-x86_64Fix
Copy the tag exactly as the releases page shows it and keep -f on the download, then make the file executable.
sudo curl -fSL https://github.com/docker/compose/releases/download/v5.8.0/docker-compose-linux-x86_64 \
-o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-composeVerify
The second check command prints 200 for your URL, and docker-compose version runs.
docker-compose versionConfirmed by docs.docker.com
How do I stop it coming back?
- Install Compose from Docker's package repository as docker-compose-plugin and run docker compose; Docker labels the standalone binary as kept only for backward compatibility, and manual installs never update themselves.
- Use curl -f (or -fSL) in every script that downloads a binary, so an HTTP error stops the script instead of producing a text file.
- On a 32-bit Raspberry Pi OS, plan the move to the 64-bit OS: Docker says Engine 28 is the last major version with 32-bit armhf packages, and 64-bit users follow the Debian instructions.
Sources
- Docker Compose: install the plugin on Linux
- Docker Compose: standalone install (backward compatibility)
- docker/compose v5.8.0 release assets
- docker/compose 1.29.2 release assets
- curl man page (--fail)
- Bash manual: command search and execution
- POSIX shell: non-built-in utility execution (ENOEXEC)
- Docker Engine on Raspberry Pi OS (32-bit)
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine on the same stack: TaxiDex, Dispatch Pro.