Docker
Deploy AiAgentNexus effortlessly using Docker containers, taking advantage of Docker's capabilities to streamline development, enable collaborative workflows, and maintain consistent environments.
Prerequisites π
Before you begin deploying AiAgentNexus with Docker, ensure your system meets the following requirements:
Docker: Install Docker (Version 24.0 or later).
Docker Compose (optional but recommended for multi-container setups): Install Docker Compose (Version 2.20 or later).
Git: Install Git.
GitHub Account: Required to access the GitHub Container Registry (ghcr).
Tip: Always use the latest stable versions to ensure optimal compatibility.
Steps to Build and Run the Container π§
Follow the instructions below to clone the repository, create a Docker image, and run it locally.
1. Clone the Repository
Clone the AiAgentNexus repository to your local system:
git clone https://github.com/ErnestikX/AiAgentNexus.git
cd AiAgentNexus2. Build the Docker Image
Use the included Dockerfile to build the Docker image:
Note: Docker image names are case-insensitive, so aiagentnexus is used for consistency.
3. Run the Docker Container
Launch the container from your built image, mapping the HTTP port 3000 inside the container to 3000 on your host machine:
Explanation of Flags:
-d: Runs the container in detached mode (background).-p 3000:3000: Maps port3000on the host to the container's port3000.
4. Access the Application
Open your browser and visit http://localhost:3000 to start using AiAgentNexus.
Using Pre-Built Docker Images π¦
AiAgentNexus provides an official Docker image hosted on the GitHub Container Registry (ghcr), with automated builds managed by GitHub Actions.
Details of the Official Image
Repository: ghcr.io/ErnestikX/AiAgentNexus
Running the Official Image π
Deploy the pre-built Docker image directly from ghcr:
Deployment via Docker Compose π
For Docker Compose users, hereβs how to get started:
Create a
docker-compose.yamlFile:Refer to the Docker Compose documentation for further details.
Launch the Service:
This command pulls the image (if not already downloaded) and starts the container in detached mode.
Update the Image:
To upgrade to the latest version, run:
This ensures your deployment stays up-to-date.
Connecting to Local Services π
If your container needs to communicate with services running on your host machine (like a local API or Browseless service), follow these instructions based on your operating system:
Windows/macOS
Use the special DNS name host.docker.internal to reference the host. No additional setup is needed. Access services using host.docker.internal:<PORT>.
Linux
Option A: Use the host network mode to share the networking stack with the host. Note: This reduces container isolation.
```bash
docker run --network="host" -d aiagentnexus
```
Option B: Identify your host's IP (e.g., 192.168.1.100) and use it directly (e.g., 192.168.1.100:<PORT>) to access local services.
Security Note: Always restrict access to sensitive services to prevent unauthorized exposure.
Setting Up a Reverse Proxy
A reverse proxy (e.g., Nginx or Traefik) can improve deployment by providing:
Load balancing.
Centralized SSL management.
Added security for backend services.
Refer to the Reverse Proxy Deployment Guide for full instructions.
Example Nginx Configuration:
Restart or reload Nginx after updating the configuration.
Key Configuration Files π
Hereβs an overview of critical files for customization and troubleshooting:
Dockerfile: Specifies steps to build the image, including Node.js setup, dependency installation, and production configurations.docker-compose.yaml: Defines theAiAgentNexusservice, including image details, port mappings, and restart policies..github/workflows/docker-image.yml: Automates the build and deployment process using GitHub Actions.
Troubleshooting π οΈ
Here are common issues and their solutions:
Port Conflicts: Use an alternative port if
3000is in use.Access Issues: Verify the container is running:
Check if
aiagentnexusis listed with the correct port mappings.Image Pull Errors: Authenticate to ghcr if required:
Container Failures: View logs to identify issues:
Connectivity Problems: Confirm firewall or network rules allow required traffic.
Security Tips π
Update Regularly: Pull the latest images for security patches:
Run with Least Privileges: Avoid running containers as root when unnecessary.
Secure Secrets: Use Docker secrets or environment variables for sensitive data.
Scan for Vulnerabilities: Employ tools like Docker Bench for Security to detect issues.
Conclusion
Docker simplifies the deployment of AiAgentNexus, ensuring reliability and consistency. Whether building locally or using pre-built images, the process is straightforward and efficient.
For additional support or contributions, visit the AiAgentNexus GitHub Repository.