Sha256: 6c3304d01e2d60b222fd3a52524fa988cbc14dd5ed0ca75f6da52b6b283b65bb

Contents?: true

Size: 645 Bytes

Versions: 4

Compression:

Stored size: 645 Bytes

Contents

require 'kontena/client'
require_relative '../common'

module Kontena::Cli::Services
  class Containers
    include Kontena::Cli::Common

    ##
    # @param [String] service_id
    def list(service_id)
      require_api_url
      token = require_token

      result = client(token).get("services/#{current_grid}/#{service_id}/containers")
      result['containers'].each do |container|
        puts "#{container['id']}:"
        puts "  node: #{container['node']['name']}"
        puts "  ip (internal): #{container['network_settings']['ip_address']}"
        puts "  status: #{container['status']}"
        puts ""
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kontena-cli-0.7.3 lib/kontena/cli/services/containers.rb
kontena-cli-0.7.2 lib/kontena/cli/services/containers.rb
kontena-cli-0.7.1 lib/kontena/cli/services/containers.rb
kontena-cli-0.7.0 lib/kontena/cli/services/containers.rb