Skip to content

Instantly share code, notes, and snippets.

@cben
Created November 5, 2017 09:08
Show Gist options
  • Select an option

  • Save cben/bdcf992d9bbdc29fba12b79a643de77c to your computer and use it in GitHub Desktop.

Select an option

Save cben/bdcf992d9bbdc29fba12b79a643de77c to your computer and use it in GitHub Desktop.

Info "owned" by a specific container

[2] pry(main)> c = Container.first
=> #<ManageIQ::Providers::Kubernetes::ContainerManager::Container:0x0055cd589010e8
 id: 1,
 ems_ref:
  "95b9aa14-7186-11e7-8ac6-001a4a162683_mongodb_centos/mongodb-32-centos7@sha256:02685168dd84c9119f8ab635078eec8697442fba93a7b342095e03b31aa8c5dd",
 restart_count: 4,
 state: "running",
 name: "mongodb",
 backing_ref: "docker://e2876b57552b753a3c9dab1be9027f3e7f395581442fe018c93c3171ce354e6b",
 last_perf_capture_on: nil,
 type: "ManageIQ::Providers::Kubernetes::ContainerManager::Container",
 container_image_id: 1,
 reason: nil,
 started_at: nil,
 finished_at: nil,
 exit_code: nil,
 signal: nil,
 message: nil,
 last_state: "terminated",
 last_reason: nil,
 last_started_at: nil,
 last_finished_at: nil,
 last_exit_code: nil,
 last_signal: nil,
 last_message: nil,
 deleted_on: nil,
 ems_id: 1,
 old_ems_id: nil,
 request_cpu_cores: nil,
 request_memory_bytes: 536870912,
 limit_cpu_cores: nil,
 limit_memory_bytes: 536870912,
 image: "centos/mongodb-32-centos7@sha256:02685168dd84c9119f8ab635078eec8697442fba93a7b342095e03b31aa8c5dd",
 image_pull_policy: "IfNotPresent",
 memory: nil,
 cpu_cores: 0.0,
 container_group_id: 1,
 privileged: false,
 run_as_user: 1000730000,
 run_as_non_root: nil,
 capabilities_add: "",
 capabilities_drop: "KILL,MKNOD,SETGID,SETUID,SYS_CHROOT",
 command: nil>

[4] pry(main)> c.container_port_configs
=> [#<ContainerPortConfig:0x0055cd58586620
  id: 1,
  ems_ref: "95b9aa14-7186-11e7-8ac6-001a4a162683_mongodb_27017__TCP",
  port: 27017,
  host_port: nil,
  protocol: "TCP",
  container_id: 1,
  name: nil>]

[5] pry(main)> c.container_env_vars
=> [#<ContainerEnvVar:0x0055cd582a0550 id: 1, name: "MONGODB_USER", value: nil, field_path: nil, container_id: 1>,
 #<ContainerEnvVar:0x0055cd5828d2c0 id: 2, name: "MONGODB_PASSWORD", value: nil, field_path: nil, container_id: 1>,
 #<ContainerEnvVar:0x0055cd5828cff0 id: 3, name: "MONGODB_ADMIN_PASSWORD", value: nil, field_path: nil, container_id: 1>,
 #<ContainerEnvVar:0x0055cd5828ce10
  id: 4,
  name: "MONGODB_DATABASE",
  value: "sampledb",
  field_path: nil,
  container_id: 1>]

Also has links to:

  • c.container_image_id
  • c.container_group_id ("name" should be unique among Containers belonging to same ContainerGroup)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment