Docker container:name network mode

627 views
Skip to first unread message

Clare Yang

unread,
Mar 16, 2017, 4:32:37 AM3/16/17
to Nomad
Hi Guys,

Sorry another question. 

To plan to use Docker container:name network mode, my thought is in a job spec to at least define 2 tasks under a same task group, one docker is network container like in k8s, another is real computing container, follow is my job spec:
job "network" {
  region = "hf"
  datacenters = ["ocp"]

  type = "service"

  constraint {
    attribute = "${node.class}"
    value = "influxdb"
  }

  update {
    stagger = "10s"
    max_parallel = 1
  }

  group "network" {
    count = 1

    restart {
      attempts = 10
      interval = "5m"
      delay = "25s"
      mode = "delay"
    }

    ephemeral_disk {
      size = 300
    }

    task "pause" {
      driver = "docker"
      config {
        image = "kubernetes/pause"
      }

      resources {
        cpu    = 100 # 500 MHz
        memory = 64 # 256MB
        network {
          mbits = 10
        }
      }
    }

   task "customer" {
      driver = "docker"
      config {
        image = "xxxx/zhanyang/customer"
        network_mode = "container:pause-${NOMAD_ALLOC_ID}"
      }

      resources {
        cpu    = 300 # 500 MHz
        memory = 256 # 256MB
      }
    }
  }
}

But can't launch job, error info as:
# nomad alloc-status bbf48df2
ID                  = bbf48df2
Eval ID             = 1b851332
Name                = network.network[0]
Node ID             = d9de806f
Job ID              = network
Client Status       = failed
Client Description  = <none>
Desired Status      = run
Desired Description = <none>
Created At          = 03/16/17 08:14:54 GMT

Task "customer" is "dead"
Task Resources
CPU      Memory   Disk     IOPS  Addresses
300 MHz  256 MiB  300 MiB  0

Recent Events:
Time                   Type            Description
03/16/17 08:14:36 GMT  Not Restarting  Error was unrecoverable
03/16/17 08:14:36 GMT  Driver Failure  failed to start task "customer" for alloc "bbf48df2-1625-89b1-ace5-54edb2f97ec4": Failed to start container 6e14f3b6963f9f7860ac48a5e493f46e707cda9a6173904e2a673c6ee1086315: API error (404): {"message":"No such container: pause-bbf48df2-1625-89b1-ace5-54edb2f97ec4"}
03/16/17 08:14:33 GMT  Driver          Downloading image xxxx/zhanyang/customer:latest
03/16/17 08:14:33 GMT  Task Setup      Building Task Directory
03/16/17 08:14:33 GMT  Received        Task received by client

Task "pause" is "dead"
Task Resources
CPU      Memory  Disk     IOPS  Addresses
100 MHz  64 MiB  300 MiB  0

Recent Events:
Time                   Type                 Description
03/16/17 08:14:38 GMT  Killed               Task successfully killed
03/16/17 08:14:38 GMT  Killing              Sent interrupt. Waiting 5s before force killing
03/16/17 08:14:36 GMT  Sibling Task Failed  Task's sibling "customer" failed
03/16/17 08:14:38 GMT  Started              Task started by client
03/16/17 08:14:33 GMT  Driver               Downloading image kubernetes/pause:latest
03/16/17 08:14:33 GMT  Task Setup           Building Task Directory
03/16/17 08:14:33 GMT  Received             Task received by client

it indicates can't find the network container name, but i can start the two containers separated, could you guys help tell me this why not work or give a solution? or how can make a task start ahead of another one?

thanks,
Clare

Alex Dadgar

unread,
Mar 16, 2017, 12:54:45 PM3/16/17
to Nomad, Clare Yang
Hey Clare,

As you have guessed it doesn’t work because there is no task start up ordering. This is on the roadmap. However, Nomad does not currently try to support Docker container networking. I would suggest you use Docker host networking and use service discovery to find the addresses of other services you need to talk to.

Thanks,
Alex Dadgar
--
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/da7301e4-899b-46db-8fe4-af549a2da92a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Clare Yang

unread,
Mar 17, 2017, 1:32:19 AM3/17/17
to Nomad
Thanks, when is this ready on your roadmap, i think if can setup task start ordering, maybe can use docker container network mode.

Thanks,
Clare

Alex Dadgar

unread,
Mar 17, 2017, 2:17:17 PM3/17/17
to Nomad, Clare Yang
Hey Clare,

It is not being actively worked on right now and is probably a few months out!

Thanks,
Alex Dadgar

Richmod

unread,
Mar 23, 2017, 6:43:41 AM3/23/17
to Nomad
哥们,能不能留个你的QQ,我有一些关于Nomad的问题想找个人请教下,但是我英文水平不好,在这里发出来大家都理解不了,很无奈啊。

在 2017年3月16日星期四 UTC+8下午4:32:37,Clare Yang写道:

Clare Yang

unread,
Mar 26, 2017, 12:14:14 AM3/26/17
to Nomad
383507873
Reply all
Reply to author
Forward
0 new messages