Class: NexusAPI::DockerShell

Inherits:
Object
  • Object
show all
Defined in:
lib/nexus_api/docker_shell.rb

Instance Method Summary collapse

Instance Method Details

#authenticate!(username, password, host) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/nexus_api/docker_shell.rb', line 20

def authenticate!(username, password, host)
  Docker.authenticate!(
    'username' => username,
    'password' => password,
    'serveraddress' => host
  )
end

#list_imagesObject



28
29
30
# File 'lib/nexus_api/docker_shell.rb', line 28

def list_images
  Docker::Image.all
end

#pull_image(username, password, image_name) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/nexus_api/docker_shell.rb', line 9

def pull_image(username, password, image_name)
  Docker::Image.create(
    'username' => username,
    'password' => password,
    'fromImage' => image_name
  )
rescue Docker::Error::ClientError => error
  puts "Error: Could not pull Docker image '#{image_name}'"
  puts error
end

#validate_version!Object



5
6
7
# File 'lib/nexus_api/docker_shell.rb', line 5

def validate_version!
  Docker.validate_version!
end