How to Restart the TencentDB Agent Memory Service: A Complete Docker Guide

To restart the TencentDB Agent Memory service, execute ./stop-all.sh followed by ./start-all.sh from the deploy/global-images/ directory, which gracefully stops the three Docker containers (memory-core, memory-hub, and proxy) and relaunches them while preserving your data volumes.

The TencentDB Agent Memory service provides LLM inference and knowledge-base capabilities through a containerized architecture defined in the TencentCloud/TencentDB-Agent-Memory repository. When you need to restart the TencentDB Agent Memory service—whether to apply configuration changes, recover from errors, or update container images—you use the orchestration scripts located in deploy/global-images/. This guide covers the exact commands, internal mechanics, and file paths necessary for reliable service restarts.

Understanding the Service Architecture

The deployment consists of three interconnected Docker containers that must restart in sequence:

  • tdai-memory-core: The core engine that runs LLM inference
  • tdai-memory-hub: The panel and knowledge-base service providing the web interface
  • tdai-proxy: The HTTP proxy that exposes the LLM API and handles authentication

These containers are managed through helper scripts in deploy/global-images/ that handle environment validation, port checking, and health monitoring.

Prerequisites and Environment Files

Before restarting, navigate to the deployment directory. The scripts require a .env file containing image names, ports, and LLM credentials.

If .env is missing, start-all.sh automatically generates it from .env.example and launches an interactive configuration prompt via the interactive_llm_setup function. To avoid interactive prompts during restart, ensure your .env file exists and contains valid values.

Step-by-Step Restart Instructions

Quick Restart (Preserve Data)

For routine restarts that retain all knowledge bases and configuration:

cd deploy/global-images/
./stop-all.sh
./start-all.sh

The stop-all.sh script reads the .env file to identify volume names, then executes docker rm -f on tdai-proxy, tdai-memory-hub, and tdai-memory-core while leaving volumes intact.

Restart with Latest Images

To ensure you deploy the most recent container versions, set the PULL environment variable:

./stop-all.sh
PULL=1 ./start-all.sh

When PULL=1 is present, start-all.sh forces a docker pull of the three images before container initialization, updating the stack to the latest release.

Clean Restart (Purge All Data)

Use this approach only when you need a completely fresh environment. This deletes persistent data, networks, and generated configs:

./stop-all.sh --purge
PULL=1 ./start-all.sh

According to the implementation in stop-all.sh, the --purge flag triggers docker volume rm on the service volumes and removes the custom Docker network tdai-memory-stack, alongside deleting the admin-key file and generated configuration directories.

How the Restart Scripts Work Internally

Understanding the script mechanics ensures effective troubleshooting.

Stopping the Service

stop-all.sh performs the following operations:

  1. Loads environment variables from .env if present
  2. Iterates over the three container names and executes docker rm -f on each
  3. With --purge, additionally runs docker volume rm and removes the network bridge

Starting the Service

start-all.sh sources the shared library _lib.sh and executes this sequence:

  1. Creates .env from .env.example when missing
  2. Validates required variables via the require_vars function
  3. Checks port availability using check_ports to prevent binding conflicts
  4. Sequentially launches start-memory-core.sh, start-memory-hub.sh, and start-proxy.sh
  5. Waits for each container to report healthy status
  6. Prints connection endpoints and Claude Code configuration variables

Verifying the Restart

Confirm all containers are operational:

docker ps --filter "name=tdai"

Check specific component logs for errors:

docker logs -f tdai-memory-core

After successful startup, the service exposes three endpoints:

  • Memory core: http://127.0.0.1:<MEMORY_CORE_PORT>
  • Memory hub panel: http://127.0.0.1:<PANEL_PORT>
  • Proxy API: http://127.0.0.1:<PROXY_PORT>

Summary

  • Execute ./stop-all.sh followed by ./start-all.sh for standard restarts that preserve data volumes and configuration
  • Prepend PULL=1 to ./start-all.sh to automatically fetch the latest container images before launching
  • Append --purge to ./stop-all.sh only when you require a complete reset including volume deletion and network removal
  • The orchestration scripts reside in deploy/global-images/ and depend on _lib.sh for shared Docker utilities
  • Each restart validates environment variables via require_vars and checks port availability via check_ports before launching the container stack

Frequently Asked Questions

Will restarting the TencentDB Agent Memory service delete my knowledge base data?

No, standard restarts using ./stop-all.sh without flags retain all Docker volumes containing your knowledge base and conversation history. The script only executes docker rm -f on the containers, leaving volumes intact. Data loss occurs only when you explicitly pass the --purge flag, which triggers docker volume rm and removes persistent storage.

How do I update to the latest version when restarting?

Set the PULL=1 environment variable before executing ./start-all.sh. This instructs the script to run docker pull for the memory-core, memory-hub, and proxy images prior to container creation, ensuring you deploy the latest versions from the registry without manual image updates.

Why does the restart script prompt for LLM credentials again?

If your .env file was deleted or you previously ran ./stop-all.sh --purge, start-all.sh detects the missing configuration and invokes the interactive_llm_setup function to recreate the environment from .env.example. To avoid interactive prompts during restart, verify that a populated .env file exists in deploy/global-images/ before executing the start command.

What should I check if the proxy container fails to start after restart?

Run docker logs tdai-proxy to identify port conflicts or authentication errors. While start-all.sh runs check_ports to verify availability before launching, external processes may claim the configured ports between stop and start operations. Ensure no services are bound to the ports defined in your .env file before running ./start-all.sh.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →