ehazlett / interlock

Docker Event Driven Plugin System
Apache License 2.0
978 stars 130 forks source link

trying out ucp example throwing error 'Please create the volume manually' #145

Closed sfc-gh-eraigosa closed 8 years ago

sfc-gh-eraigosa commented 8 years ago

Hey, I'm trying to use interlock on UCP 1.1 instance. I'm getting this error output

compose.config.config.find: Using configuration files: ./docker-compose.yml
WARNING: compose.config.interpolation.__getitem__: The UCP_INSTANCE variable is not set. Defaulting to a blank string.
docker.auth.auth.load_config: Found 'auths' section
docker.auth.auth.parse_auth: Found entry (registry=u'docker.hos.hpecorp.net', username=u'edward.raigosa@hpe.com')
compose.cli.command.get_client: docker-compose version 1.6.2, build 4d72027
docker-py version: 1.7.2
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013
compose.cli.command.get_client: Docker base_url: https://dashboard.ucp-dev.g4ihos.itcs.hpecorp.net:443
compose.cli.command.get_client: Docker version: KernelVersion=3.10.0-327.13.1.el7.x86_64, Os=linux, BuildTime=Wed Mar  2 00:15:12 UTC 2016, ApiVersion=1.22, Version=ucp/1.1.0, GitCommit=6602e72, Arch=amd64, GoVersion=go1.6.2
compose.cli.verbose_proxy.proxy_callable: docker inspect_network <- (u'proxyinterlock_default')
compose.cli.verbose_proxy.proxy_callable: docker inspect_network -> {u'Containers': {},
 u'Driver': u'overlay',
 u'Engine': {u'Addr': u'16.85.3.132:12376',
             u'Cpus': 56,
             u'ID': u'SIRT:FJ6E:H7EI:UNQR:A55M:OO2V:RIPF:I6VN:TCS2:2B3U:CRSV:Y643',
             u'IP': u'16.85.3.132',
             u'Labels': {u'executiondriver': u'',
                         u'kernelversion': u'3.10.0-327.13.1.el7.x86_64',
                         u'operatingsystem': u'CentOS Linux 7 (Core)',
                         u'provider': u'oneview',
...
compose.volume.initialize: Volume ucp-node-certs declared as external. No new volume will be created.
compose.cli.verbose_proxy.proxy_callable: docker inspect_volume <- ('ucp-node-certs')
ERROR: compose.cli.main.main: Volume ucp-node-certs declared as external, but could not be found. Please create the volume manually using `docker volume create --name=ucp-node-certs` and try again.

This is the command I'm trying:

UCP_INSTANCE=tcp://dashboard.ucp-dev.g4ihos.itcs.hpecorp.net:3376 UCP_APP_ZONE=app.ucp-dev.g4ihos.itcs.hpecorp.net docker-compose up -d --no-build --verbose

I made some slight adjustments to the docker-compose.yml in the example, but it should be about the same.

version: '2.0'
services:
  interlock:
      image: ehazlett/interlock:1.1.0
      command: -D run
      tty: true
      ports:
          - 8080
      env_file: ./stage/config.env
      environment:
        INTERLOCK_CONFIG: |
            ListenAddr = ":8080"
            DockerURL = "${UCP_INSTANCE}"
            TLSCACert = "/certs/ca.pem"
            TLSCert = "/certs/cert.pem"
            TLSKey = "/certs/key.pem"
            [[Extensions]]
            Name = "nginx"
            ConfigPath = "/etc/nginx/nginx.conf"
            PidPath = "/etc/nginx/nginx.pid"
            MaxConn = 1024
            Port = 80
      volumes:
          - ucp-node-certs:/certs
      restart: always
      depends_on:
          - nginx

  nginx:
      image: nginx:latest
      entrypoint: nginx
      command: -g "daemon off;" -c /etc/nginx/nginx.conf
      ports:
          - 80:80
      environment:
          - "constraint:role==interlock"
      labels:
          - "interlock.ext.name=nginx"
      restart: always

  app:
      image: ehazlett/docker-demo:latest
      ports:
          - 8080
      labels:
          - "interlock.hostname=test"
          - "interlock.domain=$UCP_APP_ZONE"
      depends_on:
        - nginx
        - interlock

volumes:
    ucp-node-certs:
      external: true

This is the docker compose version:

docker-compose version
docker-compose version 1.6.2, build 4d72027
docker-py version: 1.7.2
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013

Any ideas on why compose is telling me to create the volume?

ehazlett commented 8 years ago

Can you give the output of echo $DOCKER_HOST? It doesn't look like you are configured to use UCP.

Also, you need to export those variables as I believe compose will subshell out. See the warning where compose is setting to an empty string.

sfc-gh-eraigosa commented 8 years ago

Normal docker commands are working good. Here is the output for echo $DOCKER_HOST

echo $DOCKER_HOST
tcp://dashboard.ucp-dev.g4ihos.itcs.hpecorp.net:443

I updated the command and compose file im using as well based on some of the swarm examples. Here is what i have:

version: '2.0'
services:
  interlock:
      image: ehazlett/interlock:1.1.0
      command: -D run
      tty: true
      ports:
          - 8080
      env_file: ./stage/config.env
      environment:
        INTERLOCK_CONFIG: |
            ListenAddr = ":8080"
            DockerURL = "${UCP_INSTANCE}"
            TLSCACert = "/certs/ca.pem"
            TLSCert = "/certs/cert.pem"
            TLSKey = "/certs/key.pem"
            [[Extensions]]
            Name = "nginx"
            ConfigPath = "/etc/nginx/nginx.conf"
            PidPath = "/etc/nginx/nginx.pid"
            TemplatePaht = "/etc/interlock/nginx.conf.template"
            MaxConn = 1024
            Port = 80
            NginxPlusEnabled = false
      volumes:
          - ucp-node-certs:/certs
          - nginx:/etc/nginx
      restart: always

  nginx:
      image: nginx:1.9.15
      entrypoint: nginx
      command: -g "daemon off;" -c /etc/nginx/nginx.conf
      ports:
          - 80:80
      environment:
          - "constraint:role==interlock"
      labels:
          - "interlock.ext.name=nginx"
      links:
          - interlock:interlock
      volumes:
          - nginx:/etc/nginx
      restart: always

  app:
      image: ehazlett/docker-demo:latest
      ports:
          - 8080
      labels:
          - "interlock.hostname=test"
          - "interlock.domain=$UCP_APP_ZONE"
      depends_on:
        - nginx
        - interlock

volumes:
    ucp-node-certs:
      external: true
    nginx:

Here is what i have for output:

UCP_INSTANCE=tcp://dashboard.ucp-dev.g4ihos.itcs.hpecorp.net:3376 UCP_APP_ZONE=app.ucp-dev.g4ihos.itcs.hpecorp.net docker-compose --verbose up -d --no-build
compose.config.config.find: Using configuration files: ./docker-compose.yml
docker.auth.auth.load_config: Found 'auths' section
docker.auth.auth.parse_auth: Found entry (registry=u'docker.hos.hpecorp.net', username=u'edward.raigosa@hpe.com')
compose.cli.command.get_client: docker-compose version 1.6.2, build 4d72027
docker-py version: 1.7.2
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013
compose.cli.command.get_client: Docker base_url: https://dashboard.ucp-dev.g4ihos.itcs.hpecorp.net:443
compose.cli.command.get_client: Docker version: KernelVersion=3.10.0-327.13.1.el7.x86_64, Os=linux, BuildTime=Wed Mar  2 00:15:12 UTC 2016, ApiVersion=1.22, Version=ucp/1.1.0, GitCommit=6602e72, Arch=amd64, GoVersion=go1.6.2
compose.cli.verbose_proxy.proxy_callable: docker inspect_network <- (u'proxyinterlock_default')
compose.cli.verbose_proxy.proxy_callable: docker inspect_network -> {u'Containers': {},
 u'Driver': u'overlay',
 u'Engine': {u'Addr': u'16.85.3.132:12376',
             u'Cpus': 56,
             u'ID': u'SIRT:FJ6E:H7EI:UNQR:A55M:OO2V:RIPF:I6VN:TCS2:2B3U:CRSV:Y643',
             u'IP': u'16.85.3.132',
             u'Labels': {u'executiondriver': u'',
                         u'kernelversion': u'3.10.0-327.13.1.el7.x86_64',
                         u'operatingsystem': u'CentOS Linux 7 (Core)',
                         u'provider': u'oneview',
...
compose.volume.initialize: Volume ucp-node-certs declared as external. No new volume will be created.
compose.cli.verbose_proxy.proxy_callable: docker inspect_volume <- ('ucp-node-certs')
ERROR: compose.cli.main.main: Volume ucp-node-certs declared as external, but could not be found. Please create the volume manually using `docker volume create --name=ucp-node-certs` and try again.

I do have a workaround , which is to use docker run -v ucp-node-certs:/certs busybox sh, then copy the certs and insert them into the volume that gets created when i remove external: true.

ehazlett commented 8 years ago

Ok this looks like an issue with compose. I've updated the example to revert back to the version 1 format and it's working fine from here. Please try again and see if you run into the same thing. I've pinged the compose team to see if they can confirm the issue.

sfc-gh-eraigosa commented 8 years ago

@ehazlett you rock! it works :dancer:

Feel free to close this one, or do what's needed. Much appreciated.

ehazlett commented 8 years ago

thanks!