Coder Social home page Coder Social logo

taqtiqa-mark / docker-nomad Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vancluever/docker-nomad

0.0 1.0 0.0 22 KB

Docker image for Nomad, based on official Consul image

License: Mozilla Public License 2.0

Shell 83.15% Makefile 16.85%

docker-nomad's Introduction

A Docker Container for Nomad

This repo contains the Dockerfiles and shell scripts for my Nomad Docker image on Docker Hub, based on the official Consul image.

Make sure you check out the Nomad homepage for more information on Nomad itself.

About this Image

As this image is based on the Consul image, many of the same idioms apply to this image. The construction is similar, using Alpine Linux as the base. However, since Nomad uses cgo and normally is dynamically linked, the binary is custom built against a specific release beforehand and uploaded to the image in the place of the upstream binary.

Usage

This doc assumes you are familiar with Nomad - if you need to learn how to use it specifically, make sure you check out the homepage.

Implications of running Nomad in a Container

Keep in mind that by running this container you are, in fact, running any scheduling operations executed by this instance of Nomad within the container. This means a few things:

  • Anything run via the non-containerized drivers (ie: Fork/Exec, Java) will need to have respective dependencies baked in, ie: by building a new image off this one.
  • Containers (Docker/rkt) will need to have respective permissions delegated to the container. Docker is discussed in detail below.

Docker driver considerations

In order to use Docker properly with this container, you need to share the Docker socket with the container. Appropriate in-container permissions need to be applied too. The init script takes care of this as long as you pass in DOCKER_GID to the container with the group ID of the local host's docker group.

/tmp also needs to be shared, possibly until go-dockerclient#528 is fixed. More info. Hence, the full command for dev mode is:

docker run --net=host --volume /var/run/docker.sock:/var/run/docker.sock \
  --volume /tmp:/tmp --env DOCKER_GID=`getent group docker | cut -d: -f3` \
  --rm vancluever/nomad

Note that if you build your own container with Docker baked in, you do not need to supply the local Docker host's GID - we assume you know what you are doing, and fail if we see a Docker group with the GID passed in.

Development Mode

Running this container with no arguments will load the container in development mode.

docker run --net=host --rm vancluever/nomad

--net=host is important to ensure that you will be able to reach respective ports from the host.

Running with Data Dir Mounted

If you are running Nomad just as an easy way to get the software, but otherwise are running off the host, you may need to mount the data directory to the host:

docker run --net=host --volume /var/run/docker.sock:/var/run/docker.sock \
  --volume /tmp:/tmp --volume /nomad/data:/nomad/data \
  --env DOCKER_GID=`getent group docker | cut -d: -f3` \
  --rm vancluever/nomad agent AGENTOPTS

Note that AGENTOPTS here represents the agent options that would need to be added to agent, example: -server.

Coming Soon

Watch this space and the GitHub repo for more examples, such as running as a service, more details on internals, and what not.

docker-nomad's People

Contributors

vancluever avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.