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