This blog has demonstrated how to fix the “docker-compose: command not found” error.
How Does the “docker-compose: command not found” Error Occur?
Docker includes the Docker-compose utility with the installation of Docker-desktop for Windows or Mac. However, occasionally or in older Docker versions, docker-compose may not be installed along with Docker. As a result, when users run the “docker-compose” command, they may get the error “docker-compose: command not found”, as shown below:
How to Fix the “docker-compose: command not found” Error?
To resolve the specified error, install docker-compose separately using the below-stated instructions.
Step 1: Open Windows PowerShell
Launch the Windows PowerShell terminal as administrator from the Start menu:
Step 2: Set Security Protocol
Configure the PowerShell Security protocol “Tls12” through the mentioned command. This protocol must be followed to install Docker tools from the GitHub repository:
Step 3: Install Docker Compose
Next, install the Docker compose utility with the help of the given command:
The command will install the “docker-compose.exe” file in the “ProgramFiles\Docker” directory:
Step 4: Paste the “docker-compose.exe” in Docker “bin” Directory
Navigate the “ProgramFiles\Docker\” directory and cut the “docker-compose.exe” file with the help of “CTRL+X” key:
Next, open the “bin” directory of Docker by navigating the “ProgramFiles\Docker\Docker\resources\bin” and paste the “docker-compose.exe” file using the “CTRL+V” key:
Step 5: Verification
Lastly, verify whether the error has been resolved or not by executing the “docker-compose” command:
The output shows that we have successfully resolved the stated error:
We have offered a simple solution to resolve the “command not found: docker-compose” error.
To fix the “docker-compose: command not found” error, first, check if the “docker-compose.exe” file is installed or not along with Docker. If the Docker compose is not installed, open Windows PowerShell and configure the PowerShell Security protocol “Tls12”. After that, install the Docker Compose tool using the provided command in the above section. This blog has demonstrated how to resolve the “docker-compose: command not found” error.