Docker –add-host flags not working for registry 2.0 webhooks notifications

I had to connect to the Docker host (where my application is running at 8080) from within my registry container. To enable this, i passed the Docker host’s IP Address to the container using the “–add-host” flag. Followed the github issue and Command line reference. I enabled my application endpoint:8080 in below config.yml to send webhooks notifications from registry.

This set up was working until yesterday where my application received all kinds of push/pull event notifications in docker version 1.8.2. However, it stopped working today. I tried upgrading from 1.8.2 to 1.8.3 to see if that fixes it, but no luck so far. Not sure if this is related to any Docker 1.9 release updates.

  • Changing my project files doesn't change files inside the Docker machine
  • Docker Exposing ports for Flask API
  • Is there a best practice for where to log when running multiple instances of an application with Docker?
  • “Error: spawn mongoexport ENOENT” when running dockerized node app
  • How to cat a file inside a docker image?
  • Docker ONBUILD COPY doesn't seem to copy files
  • Any inputs/suggestions/pointers would be much appreciated.

    Docker version:

    $ docker version
    Client:
     Version:      1.8.3
     API version:  1.20
     Go version:   go1.4.2
     Git commit:   f4bf5c7
     Built:        Mon Oct 12 06:06:01 UTC 2015
     OS/Arch:      linux/amd64
    
    Server:
     Version:      1.8.3
     API version:  1.20
     Go version:   go1.4.2
     Git commit:   f4bf5c7
     Built:        Mon Oct 12 06:06:01 UTC 2015
     OS/Arch:      linux/amd64
    

    Launching registry container with this command

    $docker run -d -p 5000:5000 --restart=always --add-host=dockerhost:$(ip route | awk '/docker0/ { print $NF }') --name docker_registry -v ~/docker-registry/images:/var/lib/registry -v ~/docker-registry/config/config.yml:/etc/docker/registry/config.yml registry:2.1.1
    

    config.yml looks like this, configured to send webhooks notification to my application endpoint:8080 (appListener):

    version: 0.1
    log:
      fields:
        service: registry
    storage:
      cache:
        blobdescriptor: inmemory
      filesystem:
        rootdirectory: /var/lib/registry
    http:
      addr: :5000
      headers:
        X-Content-Type-Options: [nosniff]
    health:
      storagedriver:
        enabled: true
        interval: 10s
        threshold: 3
    notifications:
      endpoints:
        - name: appListener
          url: http://dockerhost:8080/event
          headers:
            Authorization:
          timeout: 500ms
          threshold: 5
          backoff: 1s
    

    Error Logs in docker_registry:

    time="2015-10-30T23:50:15Z" level=warning msg="httpSink{http://dockerhost:8080/event} encountered too many errors, backing off"
    time="2015-10-30T23:50:16Z" level=error msg="retryingsink: error writing events: httpSink{http://dockerhost:8080/event}: error posting: Post http://dockerhost:8080/event: dial tcp 172.17.42.1:8080: connection refused, retrying"
    

    Thanks.

  • Does data needs to have a specific format to upload it in Docker?
  • No access permission error with npm global install on docker image
  • Problems deploying Keycloak in HA using Postgres in Docker
  • Execute Python script inside a given docker-compose container
  • attempting to recreate supervisor tutorial in docker, running into error (permissioning?)
  • Need example for sharing data between docker container and docker host
  • One Solution collect form web for “Docker –add-host flags not working for registry 2.0 webhooks notifications”

    The problem seems to be with application.properties file in maven application where server.address was specified as 127.0.0.1.

    server.address=127.0.0.1
    server.port=8080
    

    Fixing that to below “server.address=dockerhost”, same as “–add-host=dockerhost:..” in docker run command fixed it.

    server.address=dockerhost
    server.port=8080
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.