line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Docker::Image::Boot; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
63817
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
152
|
|
4
|
4
|
|
|
4
|
|
16
|
use warnings; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
124
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
616
|
use Test::Docker::Image::Utility qw(docker); |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
249
|
|
7
|
4
|
|
|
4
|
|
2036
|
use URI::Split 'uri_split'; |
|
4
|
|
|
|
|
9153
|
|
|
4
|
|
|
|
|
1022
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
3
|
|
|
3
|
0
|
15
|
my $class = shift; |
11
|
3
|
|
|
|
|
12
|
return bless{}, $class; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub host { |
15
|
1
|
|
|
1
|
0
|
782
|
my (undef, $auth) = uri_split $ENV{DOCKER_HOST}; |
16
|
1
|
|
|
|
|
12
|
my ($host, $port) = split ':', $auth; |
17
|
1
|
|
|
|
|
3
|
return $host; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub docker_run { |
21
|
1
|
|
|
1
|
0
|
1718
|
my ($self, $ports, $image_tag) = @_; |
22
|
1
|
|
|
|
|
5
|
my $container_id = docker(qw/run -d -t/, @$ports, $image_tag); |
23
|
1
|
|
|
|
|
531
|
return $container_id; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub docker_port { |
27
|
1
|
|
|
1
|
0
|
1928
|
my ($self, $container_id, $container_port) = @_; |
28
|
1
|
|
|
|
|
3
|
my $port_info = docker('port', $container_id, $container_port); |
29
|
1
|
|
|
|
|
467
|
my (undef, $port) = split ':', $port_info; |
30
|
1
|
|
|
|
|
3
|
return $port; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |