From 4c308f9bbd655b677fc25ee847ab518753dc434a Mon Sep 17 00:00:00 2001 From: Tom Panier Date: Wed, 8 Jun 2016 15:35:24 +0200 Subject: [PATCH 1/2] Enhanced documentation wording --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index dc4ce8f..8cd7541 100644 --- a/README.md +++ b/README.md @@ -16,12 +16,10 @@ Project homepage: [https://github.com/iamluc/docker-hostmanager](https://github. The easiest way is to use the docker image ```console -$ docker run -d --name docker-hostmanager -v /var/run/docker.sock:/var/run/docker.sock -v /etc/hosts:/hosts iamluc/docker-hostmanager +$ docker run -d --name docker-hostmanager --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /etc/hosts:/hosts iamluc/docker-hostmanager ``` -*TIPS* - -To start automatically your container with your computer, add the option `--restart=always` +*Note: the `--restart=always` option will make the container start automatically with your computer (recommended).* #### Mac OS From ec52d26a184abc7426da77b489405e21f96307fa Mon Sep 17 00:00:00 2001 From: Kevin Verschaeve Date: Thu, 21 Jul 2016 00:50:22 +0200 Subject: [PATCH 2/2] merge hosts with same ip onto one line in hosts file --- src/Synchronizer.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Synchronizer.php b/src/Synchronizer.php index 2daa3d2..464489e 100644 --- a/src/Synchronizer.php +++ b/src/Synchronizer.php @@ -120,7 +120,7 @@ private function getHostsLines(Container $container) if (!empty($inspection['NetworkSettings']['IPAddress'])) { $ip = $inspection['NetworkSettings']['IPAddress']; - $lines[] = $ip.' '.implode(' ', $this->getContainerHosts($container)); + $lines[$ip] = implode(' ', $this->getContainerHosts($container)); } // Networks @@ -136,10 +136,14 @@ private function getHostsLines(Container $container) $hosts[] = $alias.'.'.$networkName; } - $lines[] = $ip.' '.implode(' ', $hosts); + $lines[$ip] = sprintf('%s%s', isset($lines[$ip]) ? $lines[$ip].' ' : '', implode(' ', $hosts)); } } + array_walk($lines, function (&$host, $ip) { + $host = $ip.' '.$host; + }); + return $lines; }