Giter VIP home page Giter VIP logo

docker-hostmanager's People

Contributors

brccabral avatar clemherreman avatar felipemarques avatar iamluc avatar jean-beru avatar kevin-verschaeve avatar neemzy avatar romainneutron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-hostmanager's Issues

DOMAIN_NAME environment variable not working

Hi, thanks a lot for your great work.

I am trying to specify custom DNS by using DOMAIN_NAME environment variable but it did not work.
I read your code a bit and I have debugging something interresting.

// src/Synchronizer.php:120
// Global
if (!empty($container['NetworkSettings']['IPAddress'])) {
    $ip = $container['NetworkSettings']['IPAddress'];

    $lines[$ip] = implode(' ', $this->getContainerHosts($container));
}

For me this condition cannot be true because $container['NetworkSettings']['IPAddress'] is null or empty.

I just move $lines[$ip] = implode(' ', $this->getContainerHosts($container)); to line 130 just after $ip declaration and it work great.

I don't know if it's really a bug or this problem come from my setup.

Maybe I have to specify an other thing to make it work ?

Docker version 20.10.6, build 370c289
docker-compose version 1.28.6, build 5db8d86f

Best regards

Compatibility with docker-machine

I suggest to deprecate environment variable DOCKER_ENTRYPOINT, and replace in code

$client = new DockerClient([], $input->getOption('entrypoint'));

by

 $client = DockerClient::createWithEnv();

It should add docker-machine compatibility

Allow to register several hosts

For one container, allow to register several hosts.

i.e.

my_container:
    environment:
        - EXTRA_HOSTS=toto.com,www.toto.com,bob.tata.com

Fails to start on Docker 1.12

The following error occurs on Ubuntu 16.04 after upgrading to Docker 1.12.0:

$ docker run --name docker-hostmanager -v /var/run/docker.sock:/var/run/docker.sock -v /etc/hosts:/hosts iamluc/docker-hostmanager 



  [Docker\Exception\APIException]                
  400 Bad Request: missing required Host header  






  [GuzzleHttp\Exception\ClientException]                                                      
  Client error response [url] /containers/json [status code] 400 [reason phrase] Bad Request  



synchronize-hosts [-f|--hosts_file HOSTS_FILE] [-t|--tld TLD]

Services compatibility (docker-compose)

Bonjour Luc :)

I recently discover you amazing tool, but it only works partially for me.
I am using docker-compose with version: '2' and 'services. But it doesn't take the DOMAIN_NAME from environment.

for exeample:
given

version: '2'

services:

  app:
    container_name: my_app
    image: 5.3.29-apache
    ports :
      - 80:80
    environment: 
     - DOMAIN_NAME=www.myapp.com

my hosts file will look like :

172.18.0.3 app.foldername_default 25e65f49.foldername_default foldername_app.foldername_default

Is there any solution to use the domainname env in this example and maybe take also the container_name ?

I tried to take a look at your code, but it's too complicated for me to fix it myself.

Merci beaucoup pour ton aide.
Léo

Mac: cannot ping docker

Hello, I have tried using the manager on mac - it works as expected. The IP is resolved correctly, but ping custom.address give a timeout - I cannot ping the container. Do you have any ideas what could be the reason. I am using a native Docker for Mac.

Use network name

When defining a network like

app:
     net: my_network

there should be an extra host named app.my_network

Docker for Windows

It look like it is with Docker-toolbox as I understand, but it is with Docker for windows ?

My hosts are successfully updated but nothing respond other that on localhost:8080

docker-compose - The domain name was not added to hosts file

The domain name was not added to hosts file
I'm using docker-compose syntax version 2.

version: '2'
services:
    web:
        container_name: test
        build:
            context: .docker
        volumes:
            - .:/var/www/html
        environment:
            DOMAIN_NAME: "dynamic-ads.dev,www.dynamic-ads.dev"
        ports:
            - 80:80
docker inspect test
"Env": [
                "DOMAIN_NAME=dynamic-ads.dev,www.dynamic-ads.dev",
                "affinity:container==0a8de1646a1a4903bc771f17589bc341762b3750a2d7f54767e4d383fd1c6b44",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "PHPIZE_DEPS=autoconf \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c",
                "PHP_INI_DIR=/usr/local/etc/php",
                "APACHE_CONFDIR=/etc/apache2",
                "APACHE_ENVVARS=/etc/apache2/envvars",
                "PHP_EXTRA_BUILD_DEPS=apache2-dev",
                "PHP_EXTRA_CONFIGURE_ARGS=--with-apxs2",
                "GPG_KEYS=0BD78B5F97500D450838F95DFE857D9A90D90EC1 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3",
                "PHP_VERSION=5.6.24",
                "PHP_FILENAME=php-5.6.24.tar.xz",
                "PHP_SHA256=ed7c38c6dac539ade62e08118258f4dac0c49beca04d8603bee4e0ea6ca8250b",
                "COMPOSER_HOME=/var/www/.composer"
            ],

but /etc/hosts file looks like

## docker-hostmanager-start
172.19.0.5 web.testdevelopment_default 2b977a71515b.testdevelopment_default test.testdevelopment_default
## docker-hostmanager-end
$ docker info
Containers: 10
 Running: 5
 Paused: 0
 Stopped: 5
Images: 80
Server Version: 1.12.1
Storage Driver: devicemapper
 Pool Name: docker-253:0-2503770-pool
 Pool Blocksize: 65.54 kB
 Base Device Size: 107.4 GB
 Backing Filesystem: xfs
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 6.629 GB
 Data Space Total: 107.4 GB
 Data Space Available: 22.77 GB
 Metadata Space Used: 13.07 MB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.134 GB
 Thin Pool Minimum Free Space: 10.74 GB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 WARNING: Usage of loopback devices is strongly discouraged for production use. Use `--storage-opt dm.thinpooldev` to specify a custom block storage device.
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.122 (2016-04-09)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: overlay bridge null host
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: seccomp
Kernel Version: 4.6.7-300.fc24.x86_64
Operating System: Fedora 24 (Workstation Edition)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.4 GiB
Name: 169.v14.nfq.lt
ID: I5UY:L2HD:OL4R:CV33:B62G:GISP:BWVG:W3QX:AZ77:MFWA:CTKR:IVHO
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Insecure Registries:
 127.0.0.0/8

Windows support

Hey guys, does it work on windows? Cannot test it at the moment.

Support for multiple domains per container

If you're working with an app which supports multi-tenant setups, your HTTP container should respond to multiple hostnames (by the used hostname, application behaves differently).

For example:

It would be cool if you could name multiple predefined hosts to use.

--restart option doesn't work on Ubuntu 16.04

The docker image doesn't load on system startup on Ubuntu 16.04 LTS with the command you provided :
$ docker run -d --name docker-hostmanager --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /etc/hosts:/hosts iamluc/docker-hostmanager

It worked flawlessly on Debian 8, though.
At the moment, I have to launch docker start docker-hostmanager manually.

Bug with docker 1.10 ?

The container is restarting.

Logs:

  [Docker\Exception\APIException]                                                             
  devmapper: Unknown device f96292f7bcdb9c99f6012b54594e6710cb10202a4b38b56bb7f2ef52599606b5  






  [GuzzleHttp\Exception\ServerException]                                                                                                                                 
  Server error response [url] /containers/7ee7ce0bdfbbff1d00a4baa08485ba28f1d06ed2dd3dd7743f8ecd02bd35d43a/json [status code] 500 [reason phrase] Internal Server Error  



synchronize-hosts [-f|--hosts_file HOSTS_FILE] [-t|--tld TLD]


PHP Notice:  Undefined index: status in /usr/local/src/docker-hostmanager/src/Docker/Event.php on line 24
PHP Notice:  Undefined index: id in /usr/local/src/docker-hostmanager/src/Docker/Event.php on line 25

Call to undefined function Symfony\Component\Serializer\Encoder\json_decode()

When using develop branch

PHP Fatal error:  Uncaught Error: Call to undefined function Symfony\Component\Serializer\Encoder\json_decode() in /usr/local/src/docker-hostmanager/vendor/symfony/serializer/Encoder/JsonDecode.php:75
Stack trace:
#0 /usr/local/src/docker-hostmanager/vendor/symfony/serializer/Encoder/JsonEncoder.php(45): Symfony\Component\Serializer\Encoder\JsonDecode->decode('[{"Id":"e920246...', 'json', Array)
#1 /usr/local/src/docker-hostmanager/vendor/symfony/serializer/Encoder/ChainDecoder.php(40): Symfony\Component\Serializer\Encoder\JsonEncoder->decode('[{"Id":"e920246...', 'json', Array)
#2 /usr/local/src/docker-hostmanager/vendor/symfony/serializer/Serializer.php(280): Symfony\Component\Serializer\Encoder\ChainDecoder->decode('[{"Id":"e920246...', 'json', Array)
#3 /usr/local/src/docker-hostmanager/vendor/symfony/serializer/Serializer.php(131): Symfony\Component\Serializer\Serializer->decode('[{"Id":"e920246...', 'json', Array)
#4 /usr/local/src/docker-hostmanager/vendor/docker-php/docker-php/generated/Resource/ContainerResource.php(4 in /usr/local/src/docker-hostmanager/vendor/symfony/serializer/Encoder/JsonDecode.php on line 75

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.