{"id":17528548,"url":"https://github.com/vancluever/docker-nomad","last_synced_at":"2025-03-06T08:32:04.252Z","repository":{"id":73276478,"uuid":"75493084","full_name":"vancluever/docker-nomad","owner":"vancluever","description":"Docker image for Nomad, based on official Consul image","archived":true,"fork":false,"pushed_at":"2020-06-02T07:05:49.000Z","size":29,"stargazers_count":14,"open_issues_count":1,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-13T02:52:12.225Z","etag":null,"topics":["docker","nomad"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vancluever.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":"2016-12-03T18:41:01.000Z","updated_at":"2024-07-25T01:30:13.000Z","dependencies_parsed_at":"2023-04-06T23:07:12.772Z","dependency_job_id":null,"html_url":"https://github.com/vancluever/docker-nomad","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vancluever%2Fdocker-nomad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vancluever%2Fdocker-nomad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vancluever%2Fdocker-nomad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vancluever%2Fdocker-nomad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vancluever","download_url":"https://codeload.github.com/vancluever/docker-nomad/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242176489,"owners_count":20084583,"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-10-20T15:44:04.490Z","updated_at":"2025-03-06T08:32:04.233Z","avatar_url":"https://github.com/vancluever.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A Docker Container for Nomad\n\nThis repo contains the Dockerfiles and shell scripts for my [Nomad Docker\nimage][nomad-docker-image] on [Docker Hub][docker-hub], based on the [official\nConsul image][official-consul-image].\n\nMake sure you check out the [Nomad homepage][nomad-homepage] for more\ninformation on Nomad itself.\n\n[nomad-docker-image]: https://hub.docker.com/r/vancluever/nomad/ \n[docker-hub]: https://hub.docker.com/\n[official-consul-image]: https://registry.hub.docker.com/_/consul/\n[nomad-homepage]: https://nomadproject.io/ \n\n## About this Image\n\nAs this image is based on the Consul image, many of the same idioms apply to\nthis image. The construction is similar, using [Alpine Linux][alpine-linux] as\nthe base.  However, since Nomad uses cgo and is dynamically linked, the binary\nis custom built against a Alpine beforehand and uploaded to the image in the\nplace of the upstream binary.\n\n[alpine-linux]: https://alpinelinux.org/\n\n## Usage\n\nThis doc assumes you are familiar with Nomad - if you need to learn how to use\nit specifically, make sure you check out the [homepage][nomad-homepage].\n\n### Development Mode\n\nRunning this container with no arguments will load the container in development\nmode.\n\n```\ndocker run --net=host --rm vancluever/nomad\n```\n\n`--net=host` is important to ensure that you will be able to reach respective\nports from the host.\n\nNote that in this very basic form you will not be able to do much as Nomad's\nprivileges will be highly restricted within the container. Continue reading for\nfurther details.\n\n### Implications of running Nomad in a Container\n\nKeep in mind that by running this container you are, in fact, running any\nscheduling operations executed by this instance of Nomad within the container.\nThis means a few things:\n\n* Anything run via the non-containerized drivers (ie: Fork/Exec, Java) will need\n  to have respective dependencies baked in, ie: by building a new image off this\n  one.\n* Your ability to run jobs may be severely limited unless you run the Nomad\n  container as root by setting `NOMAD_RUN_ROOT`. For more details, see below.\n* You will also need `SYS_ADMIN` capabilities, which are not granted to the\n  container by default, so you will need to add these with `cap-add` (again, see\n  below).\n* In order for containerized jobs to be able to be run properly, you will need\n  to share your Nomad data directory (defaults to `/nomad/data`) from the host\n  machine to the container. The path to data directory in the container **must**\n  match the path on the host - this is due to how Nomad shares certain\n  directories during job execution.  `NOMAD_DATA_DIR` must also be set with this\n  directory.\n\nNote that depending on _how_ you run your Nomad jobs, privileges, capabilities,\nor shared directories above what is mentioned may also be needed.\n\n### Directory permission information for shared volumes\n\nThe config and data directories have their permissions reset to that\nof the running Nomad process (usually `root:nomad` or `nomad:nomad`, depending\non the value of `NOMAD_RUN_ROOT`) to ensure proper access to the data. Keep this\nin mind when designing your system's filesystem layout.\n\n### Examples\n\nThe following examples are basic examples of what is necessary to run the Nomad\nimage and have it successfully execute containers. The key takeaways are:\n\n* The docker socket is shared with the host.\n* `/tmp` is shared with the host so that the default syslog sockets that Nomad\n  creates for allocations work.\n* On some examples, `/tmp/nomad/data` is shared from the host at the same path\n  within the Nomad container, and `NOMAD_DATA_DIR` is set to the appropriate\n  path so that Nomad configures with that data directory set.\n* `NOMAD_RUN_ROOT` works to grant appropriate permissions for access such to\n  things such as the Docker socket.\n* `SYS_ADMIN` capabilities are added so that Nomad can perform general\n  operations such as mounting and unmounting directories.\n\n#### Host networking\n\n```\ndocker run \\\n  --cap-add=SYS_ADMIN \\\n  --env=NOMAD_DATA_DIR=/tmp/nomad/data \\\n  --env=NOMAD_RUN_ROOT=1 \\\n  --net=host \\\n  --rm \\\n  --volume=/tmp:/tmp \\\n  --volume=/tmp/nomad/data:/tmp/nomad/data \\\n  --volume=/var/run/docker.sock:/var/run/docker.sock \\\n  vancluever/nomad\n```\n\n#### Non-host networking with Nomad API endpoint exposed\n\nNote the extra options as shown below to not only publish the API endpoint, but\nalso to ensure Nomad listens on all IPv4 addresses.\n\n```\ndocker run \\\n  --cap-add=SYS_ADMIN \\\n  --env=NOMAD_DATA_DIR=/tmp/nomad/data \\\n  --env=NOMAD_RUN_ROOT=1 \\\n  --publish=4646:4646 \\\n  --rm \\\n  --volume=/tmp:/tmp \\\n  --volume=/tmp/nomad/data:/tmp/nomad/data \\\n  --volume=/var/run/docker.sock:/var/run/docker.sock \\\n  vancluever/nomad agent -dev -bind=0.0.0.0\n```\n\n#### CoreOS systemd unit example\n\nIf you run the Nomad image as a service (such as on CoreOS), you will want to do\nsomething along the lines of the following:\n\n```\n[Unit]\nDescription=HashiCorp Nomad\nAfter=docker.service\nRequires=docker.service\n\n[Service]\nTimeoutStartSec=0\nExecStartPre=-/usr/bin/docker kill nomad\nExecStartPre=-/usr/bin/docker rm nomad\nExecStartPre=/usr/bin/docker pull nomad:VERSION\nExecStart=/usr/bin/docker run \\\n  --name=nomad \\\n  --cap-add=SYS_ADMIN \\\n  --env=NOMAD_RUN_ROOT=1 \\\n  --net=host \\\n  --rm \\\n  --volume /nomad/config:/nomad/config \\\n  --volume /nomad/data:/nomad/data \\\n  --volume=/tmp:/tmp \\\n  --volume=/var/run/docker.sock:/var/run/docker.sock \\\n  vancluever/nomad:VERSION agent -server -client\n\n[Install]\nWantedBy=multi-user.target\n```\n\nNote that you will need to set VERSION to the version of Nomad you want to run.\nAlso, unless you plan on using a directory other than `/nomad`, you don't need\nto set `NOMAD_DATA_DIR`, as the default data directory is not changing from the\ndefault.\n\nThe container's [entrypoint script][entrypoint-script] adds some pre-existing\nconfiguration. See the script for futher details and take care to not overwrite\nany of the values, namely having to do with directories.\n\n[entrypoint-script]: https://github.com/vancluever/docker-nomad/blob/master/0.X/docker-entrypoint.sh\n\nFinally note that this example also does not include any bootstrapping data or\nwhat not, and won't work on its own. You may want to set it up in tandem with\nthe [Consul image][official-consul-image].\n\n## Further Details\n\nFor further details or information on how to work with the image, or to submit\nan issue or a pull request, check the [GitHub repository][github-repository].\n\n[github-repository]: https://github.com/vancluever/docker-nomad\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvancluever%2Fdocker-nomad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvancluever%2Fdocker-nomad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvancluever%2Fdocker-nomad/lists"}