Skip to content

Commit

Permalink
DOMAIN_NAME is supported for defined Networks
Browse files Browse the repository at this point in the history
- update dependencies
  • Loading branch information
vojtabiberle committed Mar 25, 2019
1 parent 012c882 commit fbaae3f
Show file tree
Hide file tree
Showing 10 changed files with 1,093 additions and 519 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
/vendor/
/bin/docker-hostmanager.phar
/box.phar
/.idea
/.vscode
/.phpunit.result.cache
21 changes: 15 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
language: php
sudo: false
php: 5.6
php:
- 5.6
- 7.0
- 7.1
- 7.2
services:
- docker

cache:
directories:
- vendor
- $HOME/.composer/cache
- vendor
- "$HOME/.composer/cache"

install: composer install --prefer-source

Expand All @@ -17,9 +23,12 @@ before_deploy:

deploy:
provider: releases
skip_cleanup: true
api_key:
secure: "xYPmNWQNTRqLSQinnM64dRqDGAm6bKYODFmGdVLwjNqbICMHR0/sF00EPwBgIsXF100xbnjgJVRXD7lbL7nUYXWyzR2EcaW8yOxhYC0BYQMpOGI6RF0p+sMskCI5hb8Y+FT++nQZTwHPo9MtrAv2ec5r42RO2K0YM6WS6URsCqbTQnDtWcLReszRrLGVy41tkdlse9uqk63IbJmRwLunMkQBJ/BhVSRDl5Qm+Q3aDhjckZanX4QH0UrR75azut3CUIQ1l/wVF9dhKPHuvIc5+3qwkxqgOmaBFozE2hvlviWCunQsZMpaWG9L3v19VzuvypDvvvK+rhwytXsOO2gz0JGh/AL6TsonGqePYdESE7tBZ+sJz5tZ0q0yqEOLGSlxa7i5bF3KN3PCqK8eBdgBHWWDnWgO0blmPFKLYaehxZqnDHr8w5bHlW2yS1fYq8X5zkmz1fbkjpPFXX6TWsm8imlKsqzhSPBTrF+E/6f91TOLlv7tXIA0hi7Ex4ZOuzUCSs6qYWfPYPKWnguL8kmkG9wKnFahQwxVz2CM2ZPxhNQ8j03ao+wkBr6+pt6KhghqYJQ83c5GrzDXJWXbpuNdFt+RfPVLT0w17tWj3H80b/QZFa2TKQtSZ41jnAKPHHt3m178s3DfpQ6Hf1Zi1kvru0jiGKdph94j7zcYeB7uV3A="
secure: R18a+x1dIMitk7Aq5WgqDS6izrgcgAcpuqo7AqJk8RuoBqrRLT36GlKrnDSKDSI71U18CQJXmfDBeI4q3R0BD+zJJ/W9uv9g25YFlbFhdAyBlwdC7GRod+XreUOQGRDBj8PpywmxCKZrKlhftu1Yw+9p3ezDcHyQMnaUODmh11Mn2UpX1AxJePSKcsh01hbyXzKmjiyV4TBXhhEAW3diONuGVTgou5OES2925REmoD5tEMKEhS8gQ9Z2fQGNlCjYh6rkX/N2oY6zgs9zrNCEmfvaAHfsPkmnlvwsQPmRXW5PH/bBGIRFpotsIFOkeZurwpy5OkwoiV2Revxbm4sivcV9ogxRHt+MhsbQZOGmsGKvc4JtGU9gy8LGxnJXyfcKhw/gGVRXeBikZeGbnG1C8qisFBIouK7wtRb6F/qsuXMb5l4nbKaUTFM3dg8yaEygbp9vEsCShaH149gFGaAChJvSOsdDUr4/bCCDaEDhAdV+bcIjMexDd79UHOrddE0B6EWGctXzWRzn495oz1we/7B7CmFZ0wzfMjDeysukFQj7GZTFPwWIHiXMKpCiDQc9w+rWjqh3DFwNmqa8eH+hGQRQ8Dl7TpoE1ucUZQwpSiF0ES1MYlcK66bteAPolQp8Iux1IIMOBsQ2VBmxjajMXTu6ZDvrD3l8il4SE+E6QT8=
file: bin/docker-hostmanager.phar
on:
tags: true
repo: vojtabiberle/docker-hostmanager

after_deploy:
- docker build -t vojtabiberle/docker-hostmanager .
- docker_push.sh
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM iamluc/composer
FROM composer

ADD . /usr/local/src/docker-hostmanager

Expand Down
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ docker-hostmanager
Update automatically your `/etc/hosts` to access running containers.
Inspired by `vagrant-hostmanager`.

Project homepage: [https://github.com/iamluc/docker-hostmanager](https://github.com/iamluc/docker-hostmanager)
Project homepage: [https://github.com/vojtabiberle/docker-hostmanager](https://github.com/vojtabiberle/docker-hostmanager)

### USAGE

Expand All @@ -15,14 +15,14 @@ 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 --restart=always -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 vojtabiberle/docker-hostmanager
```

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

#### Mac OS

Download the PHAR executable here : https://github.com/iamluc/docker-hostmanager/releases
Download the PHAR executable here : https://github.com/vojtabiberle/docker-hostmanager/releases

And then run it:

Expand Down Expand Up @@ -51,7 +51,7 @@ $ sudo route -n add 172.0.0.0/8 $(docker-machine ip $(docker-machine active))
If the host, dont use Docker ToolBox or not a Windows 10 PRO, then needs to mount the /c/Windows folder onto VirtualBox.

```console
$ 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
$ 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 vojtabiberle/docker-hostmanager
```

After run the container we need to add a route to access container subnets.
Expand All @@ -74,7 +74,7 @@ version: '2'

services:
web:
image: iamluc/symfony
image: php
volumes:
- .:/var/www/html
```
Expand All @@ -91,7 +91,7 @@ networks:
services:
web:
image: iamluc/symfony
image: php
volumes:
- .:/var/www/html
Expand All @@ -111,6 +111,9 @@ The `mysql` container will be accessible with `mysql.myapp` or `bdd.myapp`
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.


#### Custom domain name

The `DOMAIN_NAME` environment variable lets you define additional hosts for your container.
e.g.:
```
Expand All @@ -119,7 +122,7 @@ $ docker run -d -e DOMAIN_NAME=test.com,www.test.com my_image

### Tests

To run test, execute the following command : `vendor/bin/phpunit`
To run test, execute the following command : `vendor/bin/phpunit --configuration phpunit.xml.dist`

### LICENSE

Expand Down
7 changes: 2 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
{
"name": "iamluc/docker-hostmanager",
"name": "vojtabiberle/docker-hostmanager",
"license": "MIT",
"type": "project",
"description": "Update /etc/hosts to access running containers",
"keywords": ["docker", "hosts"],
"repositories": [
{"type": "vcs", "url": "https://github.com/iamluc/docker-php.git"}
],
"require": {
"symfony/console": "^2.8|^3.0",
"docker-php/docker-php": "dev-compat-docker-1.12"
},
"require-dev": {
"phpunit/phpunit": "^5.1"
"phpunit/phpunit": "^8"
},
"bin": [
"bin/docker-hostmanager"
Expand Down
Loading

0 comments on commit fbaae3f

Please sign in to comment.