From 9c95c1c7a32606637b80d24244138426597e18bd Mon Sep 17 00:00:00 2001 From: mrFleshka Date: Mon, 27 May 2019 17:38:15 +0300 Subject: [PATCH] Updated readme --- README.md | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/README.md b/README.md index c99ada2..e62ec7b 100644 --- a/README.md +++ b/README.md @@ -27,4 +27,84 @@ For example, the following container would be available via DNS as `myname`, `my If you need more features like **systemd interation** and **dns forwarding** please check [resolvable](https://hub.docker.com/r/mgood/resolvable/) +## Windows Host implementation + +If windows is your host machine OS, then you may have problems configuring the network and accessing containers. + +To solve problems, you need to manually create a network for the docker. + +Example of creating a network: + +```bash +docker network create --subnet=172.25.0.0/16 dev-test +``` + +You must select a subnet to forward all requests to this subnet to the docker’s Hyper-V virtual machine. + +You can add a route for the subnet this way: + +```bash +route /P add 172.25.0.0 MASK 255.255.0.0 10.0.75.2 +``` + +Where 10.0.75.2 is your main docker VM ip. + +Next, in the `docker-compose.yml` file, you need to add your network as a external and set up aliases for the containers: + +```yaml +version: '3' +services: + nginx: + image: 'nginx:latest' + container_name: nginx-test + volumes: + - './.docker/nginx/conf:/etc/nginx/conf.d' + - '.:/var/www/app' + - './.docker/nginx/logs:/var/log/nginx' + networks: + development: + aliases: + - mydomain.test +networks: + development: + external: + name: dev-test +``` + +Wor windows run container like this: + +```bash +docker run -d --restart=always --name docker-hoster -v /var/run/docker.sock:/tmp/docker.sock -v /c/Windows/System32/drivers/etc/hosts:/tmp/hosts dvdarias/docker-hoster +``` + +You can use the `--restart=always` flag to automatically turn it on with docker restart. + +## Network and Domain filtering + +You can run container with additional service parameters for enable network and domain filtering (for clearing data in your hosts file). + +Add in the end os run command: + +``` +... python -u hoster.py --networks --masks +``` + +You can add networks by name and domain masks as substring of domain. + +For test example: + +```bash +docker run -it --rm --name docker-hoster -v /var/run/docker.sock:/tmp/docker.sock -v /c/Windows/System32/drivers/etc/hosts:/tmp/hosts dvdarias/docker-hoster python -u hoster.py --networks dev-test dev-test2 --masks .test .local +``` + +And if `docker-compose up` for previous config, you will see next in your hosts: + +``` +#-----------Docker-Hoster-Domains---------- +172.25.0.2 webpack.test +#-----Do-not-add-hosts-after-this-line----- +``` + +--- + Any contribution is, of course, welcome. :)