Sha256: f45f1ea96b9acbc4262af49316bf5df220759644299da021994bf6d45cf860ef

Contents?: true

Size: 884 Bytes

Versions: 9

Compression:

Stored size: 884 Bytes

Contents

# frozen_string_literal: true

# takelage docker container check existing
module DockerContainerCheckExisting
  # Backend method for docker container check existing.
  # @return [Boolean] is container existing?
  def docker_container_check_existing(container)
    log.debug "Checking if container \"#{container}\" is existing"

    return false unless docker_check_daemon

    stdout_str = run _docker_container_cmd_check_existing container

    if stdout_str.to_s.strip.empty?
      log.debug "Container \"#{container}\" is not existing"
      return false
    end

    log.debug "Container \"#{container}\" is existing"
    true
  end

  private

  # Format command to check if docker container exists.
  def _docker_container_cmd_check_existing(container)
    format(
      config.active['cmd_docker_container_check_existing_docker_ps'],
      container: container
    )
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
takelage-0.26.4 lib/takelage/docker/container/check/existing.rb
takelage-0.26.3 lib/takelage/docker/container/check/existing.rb
takelage-0.26.2 lib/takelage/docker/container/check/existing.rb
takelage-0.25.10 lib/takelage/docker/container/check/existing.rb
takelage-0.25.8 lib/takelage/docker/container/check/existing.rb
takelage-0.24.0 lib/takelage/docker/container/check/existing.rb
takelage-0.23.3 lib/takelage/docker/container/check/existing.rb
takelage-0.23.2 lib/takelage/docker/container/check/existing.rb
takelage-0.23.1 lib/takelage/docker/container/check/existing.rb