AgentSkillsCN

stop-services

在 EC2 上停止所有 MLOps 服务。以干净利落的方式关闭 Docker Compose 和 Minikube。

SKILL.md
--- frontmatter
name: stop-services
description: Stop all MLOps services on EC2. Shuts down Docker Compose and Minikube cleanly.

Stop All MLOps Services

Primary Action

Run the stop script, which handles the full shutdown sequence (Docker Compose first, then Minikube) in the correct order:

code
./scripts/stop-mlops-services.sh

Monitor the output for any [ERROR] lines. The script prints a final status check confirming everything is down.

Script Flags

  • --keep-minikube — Stop Docker Compose services but leave Minikube running (useful if you plan to restart compose services soon without the overhead of recreating the K8s cluster)
  • --remove-volumes — Remove Docker volumes during shutdown (DESTRUCTIVE: deletes Postgres data, MLflow experiments, Airflow history). The script prompts for confirmation before proceeding.

Verification

After the script completes, confirm everything is down:

code
minikube status 2>&1 || true
docker ps --format 'table {{.Names}}\t{{.Status}}'
  • Minikube should report "not found" or show no profile
  • No mlops-related containers should be running

Troubleshooting

Script hangs during docker compose down

A container may be stuck. Cancel the script (Ctrl+C) and force-remove the hung container:

code
docker rm -f <hung_container_name>

Then rerun ./scripts/stop-mlops-services.sh.

Minikube delete fails

If minikube delete errors out:

code
minikube delete --all --purge

If that also fails, force-remove the minikube Docker container:

code
docker rm -f minikube

Some containers still running after script completes

Force-stop and remove them:

code
docker rm -f $(docker ps -q --filter "name=mlops-services")

Partial Shutdown

To stop just one service without bringing down the whole stack:

code
cd /home/ubuntu/health-predict/mlops-services
docker compose --env-file /home/ubuntu/health-predict/.env stop <service>

To restart it later:

code
docker compose --env-file /home/ubuntu/health-predict/.env up -d --no-deps <service>

Always use --no-deps when targeting a single service to avoid the docker-compose v1 ContainerConfig bug.