예제 #1
0
 /**
  * @return bool
  */
 private function configureVirtualMachine()
 {
     $needMachineRestart = false;
     $daemonArguments = '-H unix:///var/run/docker.sock --bip=172.17.42.1/16 --dns=172.17.42.1';
     $bashFileManipulator = new BashFileManipulator(new SshFileManipulator($this->sshClient, '/var/lib/boot2docker/profile'));
     $extraArguments = $bashFileManipulator->getValue('EXTRA_ARGS');
     if (strpos($extraArguments, $daemonArguments) === false) {
         $bashFileManipulator->replaceValue('EXTRA_ARGS', $extraArguments . ' ' . $daemonArguments);
         $needMachineRestart = true;
     }
     if (!$this->dnsDockerIsInStartupConfiguration()) {
         $bootScript = 'sleep 5' . PHP_EOL . 'docker start dnsdock || docker run -d -v /var/run/docker.sock:/var/run/docker.sock --name dnsdock -p 172.17.42.1:53:53/udp tonistiigi/dnsdock' . PHP_EOL;
         $this->sshClient->run('echo "' . $bootScript . '" | sudo tee -a /var/lib/boot2docker/bootlocal.sh');
         $needMachineRestart = true;
     }
     return $needMachineRestart;
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function write($contents)
 {
     return $this->sshClient->run('echo "' . str_replace('"', '\\"', $contents) . '" | sudo tee ' . $this->filePath);
 }