1

Using an example from the DC/OS docs, if I launch a pod using the following definition, I can see that the pod has been successfully deployed.

{
   "id":"/pod-with-endpoint",
   "containers":[
      {
         "name":"simple-docker",
         "resources":{
            "cpus":1,
            "mem":128,
            "disk":0,
            "gpus":0
         },
         "image":{
            "kind":"DOCKER",
            "id":"nginx"
         },
         "endpoints":[
            {
               "name":"web",
               "containerPort":80,
               "protocol":[
                  "http"
               ]
            }
         ]
      }
   ],
   "networks":[
      {
         "mode":"container"
      }
   ]
}

Running dcos marathon pod list displays the following:

ID+TASKS            INSTANCES  VERSION                   STATUS  STATUS SINCE             WAITING
/pod-with-endpoint      1      2018-02-17T11:10:50.047Z  STABLE  2018-02-17T11:10:51.43Z  False
 |-simple-docker

How can I then access the nginx container?

For instance, if I was running a marathon app, I could ssh into the agent node that the task was running on then access a container by running docker exec -it container_id bash.

I can't see any containers on the agent nodes when running docker ps, presumably because pods use the Universal Container Runtime (UCR), so I can't see how I can connect to containers launched in a pod.

Jonas
  • 121,568
  • 97
  • 310
  • 388

1 Answers1

2

You can use dcos task cli to achieve this :

 # Get the dcos task ID 
 dcos task [task_name]

 # Run task exec with task id and command to run
 dcos task exec [--interactive --tty] <task_id> <cmd> [<args>...]

 # Example
 dcos task exec --interactive --tty hello-world.df11367a-664354-11e8-8e5a-d6f1851c7c1c bash
Parvez Kazi
  • 660
  • 5
  • 13