-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker Task Driver: advanced options and privileged mode #328
Comments
Hey Jeff, Agreed some of the more advance flags need to be added. I would not go with the fork/exec strategy because it won't allow you to wait for the container task to finish. Docker commands are passed to the dameon so |
There seems to be a handful of requests to enhance the configuration options for drivers (specifically docker). We would like to submit a PR for the Docker driver, addressing this issue as well as others. but would like to hear your opinion of how you prefer it is implemented. It seems driver based configuration best fits within the Task Config uses Keep the Example Task Config ...
driver = "docker"
config{
privileged = "true"
dns = "8.8.8.8,8.8.4.4"
auth.username = "un"
auth.password = "pw"
}
... Example Driver Usage ...
privileged, _ := strconv.ParseBool(task.Config["privileged"])
dns := strings.Split(task.Config["dns"], ",")
... Task Config uses Changing It is also possible for each driver to have their own config struct, and use mapstructure to validate the Either option using ...
driver = "docker"
config{
privileged = true
dns = ["8.8.8.8", "8.8.4.4"]
auth{
username = "un"
password = "pw"
}
}
... Example Driver Usage w/assertion ...
privileged, _ := task.Config["privileged"].(bool)
dns, _ := task.Config["dns"].([]string)
... Example Driver Usage w/map structure ...
type DockerDriverConfig struct {
privileged bool
dns []string
auth struct{
un string
pw string
}
}
var config DockerDriverConfig
err := mapstructure.Decode(task.Config, &config)
if err != nil{
return err
}
privileged := config.privileged
dns = config.dns
... |
@Sdedelbrock: Lets keep it as a string for now. It is the least invasive change and should be fully expressive as well. Look forward to your PR! 👍 |
Closing at #390 enables these. |
This is a great start! It will be very helpful to have |
I can't speak for the nomad team, however my personal opinion is that it would be unwise to bloat the code base with options that may not be needed. Tackling the issues one by one gives a better wholistic view to the use cases, which may lead to better implementations. If there is a configuration option you are in need of, we would be more then happy to kick off a new issue. |
@Sdedelbrock hit the nail on the head. We want to support as many useful options for our users and this is best accomplished by seeing what our users need. |
* add a linter, and add a lint check to the makefile, remove any existing lint violations
I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues. |
From reading the documentation, it looks like there are only 3 configuration options for the docker task driver: image, command, and network_mode. Then there are other nomad options that are abstracted for all the task drivers, for example port mapping and resource limiting.
But there are a lot of other
docker run
options missing. How can I pass some advanced config parameters to Docker? For example a big one is --privileged. Other examples would be the -i, -t and -dns flags.If the advanced options are not possible, what is the best work around? Should I use the Fork/Exec driver to call
docker run
by hand with all the desired options?The text was updated successfully, but these errors were encountered: