@@ 75-88 (lines=14) @@ | ||
72 | * @param mixed $composeFiles The compose files names |
|
73 | * @param string $signal Optionnal to precise SIGNAL to send to the container for SIGKILL replacement. |
|
74 | */ |
|
75 | public function kill($composeFiles = array(), $signal = 'SIGKILL') |
|
76 | { |
|
77 | $command = 'kill'; |
|
78 | ||
79 | if ($signal !== 'SIGKILL') { |
|
80 | $command .= ' -s ' . $signal; |
|
81 | } |
|
82 | ||
83 | return $this->processResult( |
|
84 | $this->execute( |
|
85 | $this->formatCommand($command, $this->createComposeFileCollection($composeFiles)) |
|
86 | ) |
|
87 | ); |
|
88 | } |
|
89 | ||
90 | /** |
|
91 | * Build service images |
|
@@ 144-157 (lines=14) @@ | ||
141 | * @param mixed $composeFiles The compose files names |
|
142 | * @param integer $timeout If we want attempt to pull a newer version of the from image |
|
143 | */ |
|
144 | public function restart($composeFiles = array(), $timeout = 10) |
|
145 | { |
|
146 | $command = 'restart'; |
|
147 | ||
148 | if ($timeout != 10) { |
|
149 | $command .= ' --timeout='.$timeout; |
|
150 | } |
|
151 | ||
152 | return $this->processResult( |
|
153 | $this->execute( |
|
154 | $this->formatCommand($command, $this->createComposeFileCollection($composeFiles)) |
|
155 | ) |
|
156 | ); |
|
157 | } |
|
158 | ||
159 | /** |
|
160 | * Run service with command |
|
@@ 213-222 (lines=10) @@ | ||
210 | * |
|
211 | * @param mixed $composeFiles The compose files names |
|
212 | */ |
|
213 | public function ips($composeFiles = array()) |
|
214 | { |
|
215 | $command = $this->formatCommand('ps', $this->createComposeFileCollection($composeFiles)); |
|
216 | ||
217 | $command = 'for CONTAINER in $(' . $command . ' -q); '; |
|
218 | $command .= 'do echo "$(docker inspect --format \' {{ .Name }} \' $CONTAINER)\t'; |
|
219 | $command .= '$(docker inspect --format \' {{ .NetworkSettings.IPAddress }} \' $CONTAINER)"; done'; |
|
220 | ||
221 | return $this->processResult($this->execute($command)); |
|
222 | } |
|
223 | ||
224 | /** |
|
225 | * Process result with returned code and output |