Skip to content
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 volume mounts: 'mounts[0].volume_options' expected a map, got 'slice' #3156

Closed
michaelw opened this issue Sep 4, 2017 · 1 comment

Comments

@michaelw
Copy link

michaelw commented Sep 4, 2017

Nomad version

client: Nomad v0.6.2 (OSX)
server: Nomad v0.6.2 (Linux)

Issue

Running a task using volume mounts results in the error below:

      config {
        image = "jenkins/jenkins:2.76-alpine"
        volumes = [
          "local/config/executors.groovy:/usr/share/jenkins/ref/init.groovy.d/executors.groovy:ro",
        ]
        mounts = [
          {
            target = "/var/jenkins_home"
            source = "jenkins-home"
            readonly = false
            volume_options {
              driver_config {
                name = "local"
              }
            }
          }
        ]
      }

Error (from alloc-status):

Recent Events:
Time                   Type             Description
09/03/17 19:57:41 PDT  Alloc Unhealthy  Unhealthy because of failed task
09/03/17 19:57:41 PDT  Not Restarting   Error was unrecoverable
09/03/17 19:57:41 PDT  Driver Failure   failed to initialize task "jenkins" for alloc "0862c4f9-890b-9cb8-e8e3-8e3be8134b72": 1 error(s) decoding:

* 'mounts[0].volume_options' expected a map, got 'slice'
09/03/17 19:57:41 PDT  Task Setup       Building Task Directory
09/03/17 19:57:41 PDT  Received         Task received by client

Removing the volume_options stanza causes the job to be scheduled successfully.
Documentation: https://www.nomadproject.io/docs/drivers/docker.html

Reproduction steps

  1. nomad run jenkins.nomad

Job file (if appropriate)

job "jenkins" {
  region = "us-west"
  datacenters = ["dc1"]

  type = "service"

  constraint {
    attribute = "${attr.kernel.name}"
    value     = "linux"
  }

  group "cicd" {
    count = 1

    restart {
      # The number of attempts to run the job within the specified interval.
      attempts = 10
      interval = "5m"

      delay = "25s"
      mode = "delay"
    }

    ephemeral_disk {
      sticky  = true
      size    = 65536
    }

    task "jenkins" {
      driver = "docker"
      config {
        image = "jenkins/jenkins:2.76-alpine"
        volumes = [
          "local/config/executors.groovy:/usr/share/jenkins/ref/init.groovy.d/executors.groovy:ro",
        ]
        mounts = [
          {
            target = "/var/jenkins_home"
            source = "jenkins-home"
            readonly = false
            volume_options {
              driver_config {
                name = "local"
              }
            }
          }
        ]
      }

      logs {
        max_files     = 50
        max_file_size = 10
      }

      resources {
        cpu    = 4000
        memory = 3072
        network {
          mbits = 100
          port "api" {
            static = 8080
          }
          port "slave" {
            static = 50000
          }
        }
      }

      service {
        name = "jenkins"
        tags = ["us-west", "cicd"]
        port = "api"
        check {
          type     = "tcp"
          interval = "10s"
          timeout  = "2s"
        }
        check {
          name     = "jenkins slave port alive"
          port     = "slave"
          type     = "tcp"
          interval = "10s"
          timeout  = "2s"
        }
      }

      template {
        data = <<EOH
import jenkins.model.*
Jenkins.instance.setNumExecutors(2)
        EOH
        destination = "local/config/executors.groovy"
        splay = "5s"
      }
    }
  }
}
dadgar added a commit that referenced this issue Sep 5, 2017
This PR fixes the parsing of Docker mounts and adds testing to ensure no
regressions.

Fixes #3156
dadgar added a commit that referenced this issue Sep 5, 2017
* Parse Docker mounts correctly

This PR fixes the parsing of Docker mounts and adds testing to ensure no
regressions.

Fixes #3156

* Review feedback
dadgar added a commit that referenced this issue Sep 6, 2017
* Parse Docker mounts correctly

This PR fixes the parsing of Docker mounts and adds testing to ensure no
regressions.

Fixes #3156

* Review feedback
@github-actions
Copy link

github-actions bot commented Dec 8, 2022

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.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants