Skip to content

bin/docker-start helper script #956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ It is recommended to keep your root docker config files in one repository, and y
- `bin/dev-urn-catalog-generate`: Generate URN's for PhpStorm and remap paths to local host. Restart PhpStorm after running this command.
- `bin/devconsole`: Alias for `bin/n98-magerun2 dev:console`
- `bin/docker-compose`: Support V1 (`docker-compose`) and V2 (`docker compose`) docker compose command, and use custom configuration files, such as `compose.yml` and `compose.dev.yml`
- `bin/docker-start`: Start the Docker application (either Orbstack or Docker Desktop)
- `bin/docker-stats`: Display container name and container ID, status for CPU, memory usage(in MiB and %), and memory limit of currently-running Docker containers.
- `bin/download`: Download specific Magento version from Composer to the container, with optional arguments of the type ("community" [default], "enterprise", or "mageos") and version ([default] is defined in `bin/download`). Ex. `bin/download mageos` or `bin/download enterprise 2.4.7-p3`
- `bin/ece-patches`: Run the Cloud Patches CLI. Ex: `bin/ece-tools apply`
Expand Down
1 change: 1 addition & 0 deletions compose/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ help:
@echo "$(call format,dev-urn-catalog-generate,'Generate URNs for PHPStorm and remap paths to local host.')"
@echo "$(call format,devconsole,'Alias for n98-magerun2 dev:console.')"
@echo "$(call format,docker-compose,'Support V1 (`docker-compose`) and V2 (`docker compose`) docker compose command, and use custom configuration files.')"
@echo "$(call format,docker-start,'Start the Docker application (either Orbstack or Docker Desktop)"
@echo "$(call format,docker-stats,'Display status for CPU$(comma) memory usage$(comma) and memory limit of currently-running Docker containers.')"
@echo "$(call format,download,'Download & extract specific Magento version to the src directory.')"
@echo "$(call format,ece-patches,'Run the Cloud Patches CLI.')"
Expand Down
53 changes: 53 additions & 0 deletions compose/bin/docker-start
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env bash

# Function to check if Docker daemon is running
docker_running() {
docker stats --no-stream &> /dev/null
return $?
}

# Check if OrbStack is installed and not running
if [ -d "/Applications/OrbStack.app" ]; then
echo "* OrbStack is installed"

if (! docker_running); then
echo "* Starting OrbStack..."
open /Applications/OrbStack.app

# Wait until Docker daemon is running via OrbStack
while (! docker_running); do
echo "* Waiting for OrbStack to initialize Docker..."
sleep 2
done

echo "* Docker is now running via OrbStack"
exit 0
else
echo "* Docker is already running (possibly via OrbStack)"
exit 0
fi
fi

# Check if Docker Desktop is installed
if [ -d "/Applications/Docker.app" ]; then
echo "* Docker Desktop is installed"

# Check if Docker is running
if (! docker_running); then
echo "* Starting Docker Desktop..."
open /Applications/Docker.app

# Wait until Docker daemon is running
while (! docker_running); do
echo "* Waiting for Docker Desktop to initialize..."
sleep 2
done

echo "* Docker Desktop is now running"
else
echo "* Docker is already running"
fi
else
echo "* Docker Desktop is not installed. Please install Docker Desktop or OrbStack."
exit 1
fi