fine grained docker run options in .nomad file

515 views
Skip to first unread message

Richard Mauri

unread,
Nov 11, 2015, 7:01:32 PM11/11/15
to Nomad
I am just getting started with Nomad, porting a bunch of home grown bash scripts over to a .nomad file.
I have  a few questions that I can't find answers to in the docs.

1. The existing docker run uses options like "--add-host ... and --privileged ...
I see there is a "command" section in the task config, but no other details. DO I have to take complete control over the entire docker run command?

2. The existing system had a home grown template system so only the variables need to be defined, vs manually editing like the .nomad file
Is there or could there be a templating system to help abstract out the "variables" ?

3. The existing system had docker port mappings like -p 81:80. I'm confused about to to specify this with the dynamic_ports settings. Would it be 

dynamic_ports = ["443", "80"]


4. How to specify the --name attribute for the container. Is it the task name?


I hope these questions make sense.

Thanks


Diptanu Choudhury

unread,
Nov 12, 2015, 6:09:06 PM11/12/15
to Richard Mauri, Nomad
Hi Richard,

Please see below my responses -

On Wed, Nov 11, 2015 at 4:01 PM, Richard Mauri <richard.er...@gmail.com> wrote:
I am just getting started with Nomad, porting a bunch of home grown bash scripts over to a .nomad file.
I have  a few questions that I can't find answers to in the docs.

1. The existing docker run uses options like "--add-host ... and --privileged ...
I see there is a "command" section in the task config, but no other details. DO I have to take complete control over the entire docker run command?
 
The command describes just the entry point of the container, the command which will be run by docker when the container is started.
 

2. The existing system had a home grown template system so only the variables need to be defined, vs manually editing like the .nomad file
Is there or could there be a templating system to help abstract out the "variables" ?

We don't have any templating support currently in Nomad but we have talked about doing it. For the time being I guess the best way to do it would be to use a configuration management system to pre-process the variables and emit the nomad configuration file. 


3. The existing system had docker port mappings like -p 81:80. I'm confused about to to specify this with the dynamic_ports settings. Would it be 

dynamic_ports = ["443", "80"]

Yeah, currently if you want port forwarding to your container that is how you would do it. However, we are currently changing the language of describing how many dynamic ports you need and how the port forwarding will work. 


4. How to specify the --name attribute for the container. Is it the task name?

Currently Nomad doesn't set any name to the container, there is an ongoing PR which would do it, so in the future the container will have a distinct name which will be a combination of the task name and the alloc id to which the task belongs to. 


I hope these questions make sense.

Thanks


--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/nomad/issues
IRC: #nomad-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Nomad" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nomad-tool+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nomad-tool/bcf25588-6956-4686-949c-be01df61973a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Thanks,
Diptanu Choudhury

Richard Mauri

unread,
Nov 12, 2015, 10:55:11 PM11/12/15
to Nomad
Thanks, but how can I pass --privileged to the docker run command from the .nomad file?

Diptanu Choudhury

unread,
Nov 13, 2015, 4:21:39 PM11/13/15
to Richard Mauri, Nomad
Hi Richard,

We have recently merged this PR - https://github.com/hashicorp/nomad/pull/384 which would allow running a container in privileged mode. This should land with the 0.2 release, but in the meantime please feel free to test it by building Nomad from master and report if you experience any issues.

On Thu, Nov 12, 2015 at 7:55 PM, Richard Mauri <richard.er...@gmail.com> wrote:
Thanks, but how can I pass --privileged to the docker run command from the .nomad file?
--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/hashicorp/nomad/issues
IRC: #nomad-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Nomad" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nomad-tool+...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Richard Mauri

unread,
Nov 13, 2015, 5:06:06 PM11/13/15
to Nomad
Great.

How about support for --add-host ?

Reply all
Reply to author
Forward
0 new messages