> For the complete documentation index, see [llms.txt](https://docs.hivel.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hivel.ai/archive/generic/hivel-on-premises-deployment-guide-generic/8.-deployment-methods/method-2-using-docker-compose-directly.md).

# Method 2: Using Docker Compose Directly

On-Prem Deployment Guide (Generic)

Use this path only if Method 1 doesn't fit your operational requirements - see the comparison in Deployment Methods above.

### Step 1: Authenticate with ECR

On both VM1 and VM2:

```
# Authenticate with Hivel's ECR
aws ecr get-login-password --region ap-south-1 | \
  docker login --username AWS --password-stdin \
  730335373269.dkr.ecr.ap-south-1.amazonaws.com
```

**Expected result:** Login Succeeded.

### Step 2: Create Docker Network

On both VM1 and VM2:

```
docker network create microservices_network
```

### Step 3: Deploy VM1 Services

On VM1 only:

```
cd /opt/docker-onprem-installer/services/vm1

# Pull all images
docker-compose --env-file ../../config/.env pull

# Deploy all services
docker-compose --env-file ../../config/.env up -d

# Or deploy a specific service
docker-compose --env-file ../../config/.env up -d auth-svc
```

### Step 4: Deploy VM2 Services

On VM2 only:

```
cd /opt/docker-onprem-installer/services/vm2

# Pull images
docker-compose --env-file ../../config/.env pull

# Deploy services
docker-compose --env-file ../../config/.env up -d
```

**Expected result:** docker-compose ps on each server shows all services as Up.

**If it fails:** see Services not starting in [Troubleshooting](/archive/generic/hivel-on-premises-deployment-guide-generic/11.-troubleshooting.md).

**Next step:** [Log Rotation Setup](/archive/generic/hivel-on-premises-deployment-guide-generic/9.-log-rotation-setup.md), then Verification and Access to confirm everything actually works.

### Docker Compose Management Commands

```
# View running services
docker-compose ps

# View logs
docker-compose logs -f
docker-compose logs -f <service-name>

# Stop services
docker-compose stop

# Start services
docker-compose start

# Restart services
docker-compose restart

# Remove services
docker-compose down

# Update services
docker-compose pull
docker-compose up -d
```

{% columns %}
{% column %} <a href="/archive/generic/hivel-on-premises-deployment-guide-generic/8.-deployment-methods/method-1-deployment-using-deploy.sh-script-recommended.md" class="button primary" data-icon="backward">Method 1: Deployment Using deploy.sh Script (Recommended)</a>
{% endcolumn %}

{% column %}

{% endcolumn %}

{% column %} <a href="/archive/generic/hivel-on-premises-deployment-guide-generic/9.-log-rotation-setup.md" class="button primary" data-icon="forward">Log Rotation Setup</a>
{% endcolumn %}
{% endcolumns %}
