Sha256: 628aa8bf44836bfee946cbd83ae2e01a0f455aac36f5c5de36dacdfa026131bc

Contents?: true

Size: 802 Bytes

Versions: 2

Compression:

Stored size: 802 Bytes

Contents

# frozen_string_literal: true

require 'avm/docker/container'

module Avm
  module Instances
    class Base
      module Dockerizable
        enable_simple_cache
        attr_reader :docker_registry

        def docker_registry=(new_value)
          @docker_registry = new_value
          reset_cache
        end

        def docker_container_exist?
          ::Avm::Executables.docker.command.append(
            ['ps', '-qaf', "name=#{docker_container_name}"]
          ).execute!.present?
        end

        def docker_container_name
          id
        end

        private

        def docker_container_uncached
          ::Avm::Docker::Container.new(self)
        end

        def docker_image_uncached
          docker_image_class.new(docker_registry)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
avm-tools-0.23.0 lib/avm/instances/base/dockerizable.rb
avm-tools-0.22.0 lib/avm/instances/base/dockerizable.rb