PHPackages                             iamluc/docker-hostmanager - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [DevOps &amp; Deployment](/categories/devops)
4. /
5. iamluc/docker-hostmanager

ActiveProject[DevOps &amp; Deployment](/categories/devops)

iamluc/docker-hostmanager
=========================

Update /etc/hosts to access running containers

v0.4.0(9y ago)1813632[6 issues](https://github.com/iamluc/docker-hostmanager/issues)[3 PRs](https://github.com/iamluc/docker-hostmanager/pulls)MITPHPCI passing

Since Dec 17Pushed 5mo ago7 watchersCompare

[ Source](https://github.com/iamluc/docker-hostmanager)[ Packagist](https://packagist.org/packages/iamluc/docker-hostmanager)[ RSS](/packages/iamluc-docker-hostmanager/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (8)Dependencies (3)Versions (13)Used By (0)

docker-hostmanager
==================

[](#docker-hostmanager)

### ABOUT

[](#about)

Update automatically your `/etc/hosts` to access running containers. Inspired by `vagrant-hostmanager`.

Project homepage:

### USAGE

[](#usage)

#### Linux

[](#linux)

The easiest way is to use the docker image

```
$ docker run -d --name docker-hostmanager --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /etc/hosts:/hosts iamluc/docker-hostmanager
```

*Note: the `--restart=always` option will make the container start automatically with your computer (recommended).*

#### Mac OS

[](#mac-os)

Download the PHAR executable here :

And then run it:

```
$ sudo php docker-hostmanager.phar synchronize-hosts
```

Note: We run the command as root as we need the permission to write file `/etc/hosts`. If you don't want to run the command as root, grant the correct permission to you user.

Before running the command, don't forget to export your docker environment variables. i.e.

```
$ eval $(docker-machine env mybox)

```

Also, you should add a route to access containers inside your VM.

```
$ sudo route -n add 172.0.0.0/8 $(docker-machine ip $(docker-machine active))

```

#### Windows

[](#windows)

If the host, dont use Docker ToolBox or not a Windows 10 PRO, then needs to mount the /c/Windows folder onto VirtualBox.

```
$ docker run -d --name docker-hostmanager --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /c/Windows/System32/drivers/etc/hosts:/hosts iamluc/docker-hostmanager
```

After run the container we need to add a route to access container subnets.

```
$ route /P add 172.17.0.0/12 192.168.99.100

```

### CONFIGURATION

[](#configuration)

#### With networks

[](#with-networks)

When a container belongs to at least one network (typically when using a `docker-compose.yml` file in version &gt;= 2), the name defined to access the container is `CONTAINER_NAME.CONTAINER_NETWORK`. It works also with the alias defined for the network.

As a container can belongs to several networks at the same time, and thanks to alias, you can define how you want to access your container.

**Example 1 (default network):**

```
version: '2'

services:
    web:
        image: iamluc/symfony
        volumes:
            - .:/var/www/html
```

The container `web` will be accessible with `web.myapp_default` (if the docker-compose project name is `myapp`)

**Example 2 (custom network name and alias):**

```
version: '3.5'

networks:
    default:
        name: myapp

services:
    web:
        image: iamluc/symfony
        volumes:
            - .:/var/www/html

    mysql:
        image: mysql
        networks:
            default:
                aliases:
                    - bdd
```

The `web` container will be accessible with `web.myapp`. The `mysql` container will be accessible with `mysql.myapp` or `bdd.myapp`

#### Without networks

[](#without-networks)

When a container has no defined network (only the default "bridge" one), it is accessible by its container name, concatened with the defined TLD (`.docker` by default). It is the case when you run a single container with the `docker` command or when you use a `docker-compose.yml` file in version 1.

The `DOMAIN_NAME` environment variable lets you define additional hosts for your container. e.g.:

```
$ docker run -d -e DOMAIN_NAME=test.com,www.test.com my_image

```

### Tests

[](#tests)

To run test, execute the following command : `vendor/bin/phpunit`

### LICENSE

[](#license)

[MIT](https://opensource.org/licenses/MIT)

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance47

Moderate activity, may be stable

Popularity26

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 71% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~28 days

Total

9

Last Release

3576d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c179ce23d755d84b764f5d944c573a9f4a654918ef2adf93055a22b5396d1e3b?d=identicon)[iamluc](/maintainers/iamluc)

---

Top Contributors

[![iamluc](https://avatars.githubusercontent.com/u/1539731?v=4)](https://github.com/iamluc "iamluc (44 commits)")[![kevin-verschaeve](https://avatars.githubusercontent.com/u/2345927?v=4)](https://github.com/kevin-verschaeve "kevin-verschaeve (5 commits)")[![Jean-Beru](https://avatars.githubusercontent.com/u/6114779?v=4)](https://github.com/Jean-Beru "Jean-Beru (3 commits)")[![brccabral](https://avatars.githubusercontent.com/u/130455?v=4)](https://github.com/brccabral "brccabral (3 commits)")[![felipemarques](https://avatars.githubusercontent.com/u/2640656?v=4)](https://github.com/felipemarques "felipemarques (3 commits)")[![neemzy](https://avatars.githubusercontent.com/u/1804389?v=4)](https://github.com/neemzy "neemzy (2 commits)")[![clemherreman](https://avatars.githubusercontent.com/u/272812?v=4)](https://github.com/clemherreman "clemherreman (1 commits)")[![romainneutron](https://avatars.githubusercontent.com/u/137574?v=4)](https://github.com/romainneutron "romainneutron (1 commits)")

---

Tags

dockerhosts

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/iamluc-docker-hostmanager/health.svg)

```
[![Health](https://phpackages.com/badges/iamluc-docker-hostmanager/health.svg)](https://phpackages.com/packages/iamluc-docker-hostmanager)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
