stop - Stop Environment

Cleanly shut down your local PrestaShop Enterprise development environment and all related services.

Purpose

The stop command gracefully stops all running containers and services in your local development environment, ensuring data is properly saved and resources are freed.

When to Use

  • End of work session: Stop environment when finished developing
  • System maintenance: Before system restart, updates, or maintenance
  • Resource management: Free up system resources when not actively developing
  • Project switching: Before switching to a different project environment
  • Troubleshooting: Stop environment to resolve issues or conflicts

Prerequisites

  • Running Environment: Environment must be currently running (started with ps-enterprise start)
  • Docker Access: Docker must be accessible for container management

Usage

Basic Stop

ps-enterprise stop

Options

Flag Short Description Required
--help -h Show command help No

Process

1. Environment Detection

  • Container Discovery: Identifies all running containers for the project
  • Service Mapping: Maps containers to their respective services
  • Dependency Analysis: Determines proper shutdown order

2. Graceful Shutdown Sequence

  • Application Shutdown: Allows PrestaShop application to complete ongoing requests
  • Database Flush: Ensures database writes are completed and flushed to disk
  • Service Termination: Stops services in reverse dependency order
  • Container Cleanup: Removes containers while preserving data volumes

3. Resource Cleanup

  • Network Cleanup: Removes temporary Docker networks
  • Volume Preservation: Maintains persistent data volumes
  • Port Release: Frees up ports used by the environment
  • Memory Cleanup: Releases container memory back to system

4. Verification

  • Stop Confirmation: Verifies all containers have stopped successfully
  • Resource Validation: Confirms ports and resources are freed
  • Data Integrity: Validates that persistent data is preserved

Data Preservation

What Gets Preserved

  • Database Data: All database content and structure
  • Uploaded Files: Media files, images, and uploads
  • Configuration: Local environment configuration
  • Logs: Application and service logs
  • Custom Code: Any local code modifications

What Gets Cleaned Up

  • Running Processes: All container processes
  • Temporary Files: Cache files and temporary data
  • Network Connections: Container network connections
  • Memory Usage: Container memory allocation
  • CPU Resources: Container CPU usage

Examples

End of Development Session

# Finish your work day
cd my-prestashop-project
ps-enterprise stop

# Environment shuts down gracefully:
# ✓ Stopping web server container
# ✓ Stopping database container
# ✓ Cleaning up network connections
# ✓ Releasing system resources
# ✓ Environment stopped successfully

Before System Maintenance

# Before restarting computer or updating Docker
ps-enterprise stop

# Ensures clean shutdown before system changes

Switching Between Projects

# Stop current project
cd current-project
ps-enterprise stop

# Switch to different project
cd ../other-project
ps-enterprise start

Troubleshooting

# Stop problematic environment
ps-enterprise stop

# Clean restart
ps-enterprise start

Success Indicators

After successful stop:

✓ Stopping web server container (prestashop-web)
✓ Stopping database container (prestashop-db)
✓ Stopping cache container (prestashop-redis)
✓ Cleaning up Docker network
✓ Releasing ports: 8080, 3306
✓ Environment stopped successfully
✓ System resources freed

Troubleshooting

Container Not Responding

⚠️  Container not responding, forcing shutdown...
✓ Container stopped successfully

Note: This is normal behavior when containers are unresponsive. Data is still preserved.

Docker Permission Error

❌ Permission denied: Cannot access Docker daemon

Solution: Check docker is running and user has right permission to use it.

Docker Service Not Available

❌ Cannot connect to Docker daemon

Solution: Check docker is running and user has right permission to use it.

Advanced Usage

Cleanup Scripts

For team environments, you might create cleanup scripts:

#!/bin/bash
# cleanup.sh - Complete environment cleanup
ps-enterprise stop
docker system prune -f
docker volume prune -f

Integration with Other Commands

Common Workflow Patterns

# Daily workflow
ps-enterprise start    # Morning
# ... development work ...
ps-enterprise stop     # Evening

# Restart cycle
ps-enterprise stop
ps-enterprise start

# Project switching
ps-enterprise stop
cd ../other-project
ps-enterprise start

Development Patterns

# Configuration changes
ps-enterprise stop
ps-enterprise config
ps-enterprise start

# Clean rebuild
ps-enterprise stop
ps-enterprise clean
ps-enterprise          # Complete setup
  • start - Start the environment after stopping
  • clean - Complete cleanup including data removal
  • log - View logs before stopping for troubleshooting
  • exec - Execute commands before stopping

Data Safety: The stop command preserves all your data, including database content and uploaded files. Only running processes are terminated.
Pro Tip: Always stop your environment when not actively developing to free up system resources for other applications.
Graceful Shutdown: Allow the stop process to complete naturally. Interrupting it may leave containers in an inconsistent state.