{"id":13785625,"url":"https://github.com/multani/docker-nomad","last_synced_at":"2025-04-05T08:05:39.673Z","repository":{"id":39864993,"uuid":"130485248","full_name":"multani/docker-nomad","owner":"multani","description":"Nomad running in Docker","archived":false,"fork":false,"pushed_at":"2025-03-18T06:44:55.000Z","size":314,"stargazers_count":96,"open_issues_count":3,"forks_count":32,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T07:05:01.066Z","etag":null,"topics":["docker","nomad"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/multani/nomad/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/multani.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-21T15:12:27.000Z","updated_at":"2025-03-18T06:44:58.000Z","dependencies_parsed_at":"2024-02-13T18:04:15.914Z","dependency_job_id":"7d4ff9fa-cab0-452b-ad03-3fe2a826de6e","html_url":"https://github.com/multani/docker-nomad","commit_stats":null,"previous_names":[],"tags_count":236,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multani%2Fdocker-nomad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multani%2Fdocker-nomad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multani%2Fdocker-nomad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multani%2Fdocker-nomad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/multani","download_url":"https://codeload.github.com/multani/docker-nomad/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247305933,"owners_count":20917208,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","nomad"],"created_at":"2024-08-03T19:01:02.701Z","updated_at":"2025-04-05T08:05:39.644Z","avatar_url":"https://github.com/multani.png","language":"Shell","readme":"# Run [Nomad](https://www.nomadproject.io) from a Docker container\n\n[![Docker Pulls](https://img.shields.io/docker/pulls/multani/nomad.svg)](https://hub.docker.com/r/multani/nomad/)\n\nThis repository builds a Docker image to run the [Nomad](https://www.nomadproject.io) scheduler.\n\nThe image is mostly useful for testing purpose, when you want to ship a small\nstack running Nomad along other containers.\n\nGet the image using:\n\n```sh\ndocker pull ghcr.io/multani/nomad\n```\nor:\n\n```sh\ndocker pull multani/nomad\n```\n\nSee below for examples on how to start a Nomad client or server.\n\nThis image is meant to be run with host network privileges.\nNomad itself can be configured:\n\n* either by bind-mounting [HCL/JSON configuration\n  files](https://www.nomadproject.io/docs/configuration/) into `/etc/nomad`\n\n* and/or by setting the configuration content directly into the\n  `NOMAD_LOCAL_CONFIG` environment variable (see examples below).\n\nYou also need to bind-mount the following directories (unless you really now\nwhat you are doing):\n\n* `/var/run/docker.sock`: to access the Docker socket, used by Nomad Docker's\n  driver\n* `/tmp`: default temporary directory used by Nomad's `-dev` mode\n\nYou can run the container as a non-root user, in which case you should set the\n`NOMAD_DISABLE_PERM_MGMT` environment variable to any value. This is especially\nuseful when running standalone Nomad servers.\n\nThe repository produces a dockerized version of Nomad following Hashicorp's\nmodel for their [Dockerized Consul\nimage](https://github.com/hashicorp/docker-consul). It is based on the work from\n[djenriquez/nomad](https://github.com/djenriquez/nomad).\n\n\n## To run:\n\nYou can use the Docker Compose file to get started:\n\n```bash\ndocker compose up\n```\n\nThe relevant Docker Compose bits are:\n\n```yaml\nversion: '2.1'\n\nservices:\n  nomad:\n    image: multani/nomad\n    build: .\n    command: agent -dev\n    privileged: true\n    network_mode: host\n    environment:\n      NOMAD_LOCAL_CONFIG: |\n        data_dir = \"/nomad/data/\"\n\n    volumes:\n      - /var/run/docker.sock:/var/run/docker.sock:rw\n      - /tmp:/tmp\n```\n\nOr you can configured Nomad on dedicated host with the following command lines.\n\n### Server\n\nNotes for the server:\n\n* It doesn't need to run as root.\n* If you decide to run it as non-root, the Nomad data directory must have the\n  proper permissions.\n\n```bash\ndocker run -d \\\n  --name nomad \\\n  --net host \\\n  --user nomad \\\n  -e NOMAD_DISABLE_PERM_MGMT=true \\\n  -e NOMAD_LOCAL_CONFIG='\nserver {\n  enabled = true\n  bootstrap_expect = 3\n}\n\ndatacenter = \"${REGION}\"\nregion     = \"${DATACENTER}\"\n\ndata_dir = \"/nomad/data/\"\n\nbind_addr = \"0.0.0.0\"\n\nadvertise {\n  http = \"{{ GetPrivateIP }}:4646\"\n  rpc  = \"{{ GetPrivateIP }}:4647\"\n  serf = \"{{ GetPrivateIP }}:4648\"\n}\n' \\\n  -v \"nomad:/nomad/data:rw\" \\\n  multani/nomad agent\n```\n\n### Client\n\nNotes for the client:\n\n* Most of the task drivers require quite high privileges, you should most\n  probably run the container as root with the [`privileged` Docker\n  flag](https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities).\n\n```bash\ndocker run -d \\\n  --name nomad \\\n  --net host \\\n  --privileged \\\n  -e NOMAD_LOCAL_CONFIG='\nclient {\n  enabled = true\n}\n\ndatacenter = \"${REGION}\"\nregion     = \"${DATACENTER}\"\n\ndata_dir = \"/nomad/data/\"\n\nbind_addr = \"0.0.0.0\"\n\nadvertise {\n  http = \"{{ GetPrivateIP }}:4646\"\n  rpc  = \"{{ GetPrivateIP }}:4647\"\n  serf = \"{{ GetPrivateIP }}:4648\"\n}\n' \\\n  -v \"/srv/nomad/data:/nomad/data:rw\" \\\n  -v \"/var/run/docker.sock:/var/run/docker.sock\" \\\n  -v \"/tmp:/tmp\" \\\n  multani/nomad agent\n```\n\nThe above command is identical to running this example in Nomad's documentation\nfor [bootstrapping with\nConsul](https://www.nomadproject.io/docs/cluster/bootstrapping.html).\n\n## Correctly configuring Nomad data directory\n\nDue to the way Nomad exposed template files it generates, you need to take\nspecial precautions when configuring its data directory.\n\nIn case you are running Docker containers and using the `template` stanza,\nthe Nomad `data_dir` has to be configured with the **exact same path as the\nhost path**, so the host Docker daemon mounts the correct paths, as exported by\nthe Nomad client, into the scheduled Docker containers.\n\nYou can run the Nomad container with the following options in this case:\n\n```bash\nexport NOMAD_DATA_DIR=/host/path/to/nomad/data\n\ndocker run \\\n  ...\\\n  -v \"$NOMAD_DATA_DIR:$NOMAD_DATA_DIR:rw\" \\\n  -e \"NOMAD_DATA_DIR=$NOMAD_DATA_DIR\" \\\n  multani/nomad agent\n```\n","funding_links":[],"categories":["Infrastructure setup"],"sub_categories":["Deployment and Cluster Setup"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmultani%2Fdocker-nomad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmultani%2Fdocker-nomad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmultani%2Fdocker-nomad/lists"}