HashiCorp Nomad
Flexible workload orchestrator for containers and non-containerized apps.
Overview
HashiCorp Nomad is a flexible workload orchestrator that simplifies the deployment and management of containerized and non-containerized applications across diverse infrastructure environments. Unlike Kubernetes, Nomad takes a minimalist approach with a single binary deployment while supporting multiple workload types including Docker containers, virtual machines, Java applications, and raw executables. This makes it particularly valuable for organizations running mixed workloads or those seeking simpler orchestration without sacrificing powerful scheduling capabilities.
This deployment runs Nomad in development mode as a single container that acts as both server and client, providing immediate access to the full Nomad experience through its web UI and API endpoints. The configuration includes Docker socket mounting to enable container orchestration and privileged access for advanced workload management. Three ports are exposed: 4646 for the HTTP API and UI, 4647 for RPC communication, and 4648 for Serf gossip protocol.
This setup is ideal for developers learning Nomad, small teams prototyping workload orchestration, and organizations evaluating alternatives to more complex orchestration platforms. The development mode configuration allows immediate job submission and testing without the complexity of multi-node cluster setup, making it perfect for experimentation with Nomad's unique multi-workload capabilities and integration with other HashiCorp tools like Consul and Vault.
Key Features
- Multi-workload support for Docker containers, VMs, Java apps, and raw executables in a single orchestrator
- Development mode with combined server/client functionality for immediate testing and prototyping
- Web UI accessible on port 4646 for visual job management and cluster monitoring
- Native Docker integration with socket mounting for container orchestration capabilities
- Built-in job scheduling with support for batch, service, and system job types
- Datacenter federation capabilities for multi-region workload distribution
- GPU scheduling support for machine learning and compute-intensive workloads
- Blue/green deployment strategies with rolling updates and canary deployments
Common Use Cases
- 1Learning and experimenting with HashiCorp Nomad's orchestration capabilities in a sandbox environment
- 2Prototyping mixed workload deployments combining containers with legacy applications
- 3Development environment for building and testing Nomad job specifications
- 4Small team container orchestration without the complexity of Kubernetes
- 5Batch processing workloads requiring flexible scheduling and resource allocation
- 6Integration testing with other HashiCorp tools like Consul service discovery and Vault secrets management
- 7Evaluating Nomad as an alternative to Docker Swarm or Kubernetes for specific use cases
Prerequisites
- Minimum 512MB RAM recommended for Nomad agent and job execution
- Docker daemon running on the host system for container workload support
- Ports 4646, 4647, and 4648 available for Nomad HTTP, RPC, and gossip communication
- Basic understanding of job scheduling concepts and HCL configuration syntax
- Familiarity with Docker concepts if planning to run containerized workloads
- Root or sudo access for privileged container operations and system resource management
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 nomad: 3 image: hashicorp/nomad:latest4 container_name: nomad5 restart: unless-stopped6 command: agent -dev -bind=0.0.0.07 ports: 8 - "4646:4646"9 - "4647:4647"10 - "4648:4648"11 volumes: 12 - nomad_data:/nomad/data13 - /var/run/docker.sock:/var/run/docker.sock14 cap_add: 15 - SYS_ADMIN16 privileged: true1718volumes: 19 nomad_data: .env Template
.env
1# Development mode - configure for productionUsage Notes
- 1Docs: https://developer.hashicorp.com/nomad/docs
- 2Access UI at http://localhost:4646
- 3Submit jobs: nomad job run myjob.nomad (or via API)
- 4Task drivers: Docker, exec, Java, raw_exec, QEMU
- 5Integrate with Consul for service discovery and Vault for secrets
- 6Dev mode runs as single node - use server/client separation for production
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 nomad:5 image: hashicorp/nomad:latest6 container_name: nomad7 restart: unless-stopped8 command: agent -dev -bind=0.0.0.09 ports:10 - "4646:4646"11 - "4647:4647"12 - "4648:4648"13 volumes:14 - nomad_data:/nomad/data15 - /var/run/docker.sock:/var/run/docker.sock16 cap_add:17 - SYS_ADMIN18 privileged: true1920volumes:21 nomad_data:22EOF2324# 2. Create the .env file25cat > .env << 'EOF'26# Development mode - configure for production27EOF2829# 3. Start the services30docker compose up -d3132# 4. View logs33docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/nomad/run | bashTroubleshooting
- Nomad UI not accessible: Verify port 4646 is properly exposed and not blocked by firewall rules
- Docker driver not available error: Ensure Docker socket is mounted and Docker daemon is running on host
- Job allocation failures: Check resource constraints and verify sufficient CPU/memory available in dev mode
- Permission denied for system jobs: Confirm container is running with privileged flag and SYS_ADMIN capability
- Nomad agent fails to start: Check for port conflicts on 4646-4648 and ensure no other Nomad instances running
- Jobs stuck in pending state: Verify task driver requirements are met and check Nomad logs for scheduling conflicts
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Ad Space
Shortcuts: C CopyF FavoriteD Download