markshust / docker-magento

Mark Shust's Docker Configuration for Magento
https://m.academy/courses/set-up-magento-2-development-environment-docker/
MIT License
2.45k stars 982 forks source link

Docker commands out of date #714

Open LetMyPeopleCode opened 2 years ago

LetMyPeopleCode commented 2 years ago

Description The docker-compose command has not only been deprecated in favor of docker compose (no dash), but newer installations of Docker do not have docker-compose. Seems this happened about 5-6 weeks ago when Docker Compose v2 went GA in April 2022.

Steps To Reproduce

  1. Install the latest Docker on a new Linux machine.
  2. Run the one-line curl and execute script.

Expected Result Script runs and Magento containers are set up.

Actual Result Script fails because there is no docker-compose in /bin/.

FIX: Add a small section instructing users to check their Docker version. docker --version. If it's 20.10.15 or higher, it's after the Compose V2 GA date. I have 20.10.16 installed.

You can either create a second copy of the script, but with docker compose or suggest they use this fix I borrowed from Stack Overflow (or you can do it for them since you get permissions to alter the hosts file).

sudo touch /bin/docker-compose
[open /bin/docker-compose in your favorite editor]
[add]
docker compose "$@"
[hit enter]
[save and quit]
sudo chmod +x /bin/docker-compose

Did the trick for me.

rangerz commented 2 years ago

This command may help you

sed -i 's/docker-compose /docker compose /' filename
markshust commented 2 years ago

Everything still works for me as-is.

@LetMyPeopleCode -- what operating system are you running? I'm wondering if Docker borked something for non-Docker-desktop setups.

LetMyPeopleCode commented 2 years ago

It was actually Docker Desktop on Ubuntu 22.04. The last two dot releases favored compose in the Go-based CLI (docker compose) vs the Python-based docker-compose. Python based one needed to be installed separately.

I found that when I installed Desktop on Mac and Windows, Mac auto-aliased to the CLI version and Windows had both options separately.