0

I've been trying to deploy my containers using Docker Machine and Docker Compose. I am running a Windows 10 with docker for windows v1.12.5.

When i start my configuration i run the following:

docker-machine env my-machine
& "C:\Program Files\Docker\Docker\Resources\bin\docker-machine.exe" env my-machine | Invoke-Expression

which sets my machine as active

Afterwards i would like to deploy my configuration, which has an nginx proxy and a nodejs application. On this proxy i have 2 sites configured.

server {
    listen 443 ssl;
    server_name mysite.com;

    access_log /var/log/nginx/mysite.log;
    error_log /var/log/nginx/mysite.log;

    location / {
      add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_set_header X-NginX-Proxy true;
      proxy_pass http://myapp:8080/;
      proxy_redirect off;
    }

    location ^~ /.well-known/acme-challenge {      
      root /usr/share/nginx/html;
      default_type "text/plain";      
    }

    ssl_certificate /etc/letsencrypt/live/msite.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/mysite.com/privkey.pem;
    ssl_session_cache shared:le_nginx_SSL:1m;
    ssl_session_timeout 1440m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_stapling on;
    ssl_stapling_verify on;
    ssl_dhparam /etc/ssl/certs/dhparam.pem;
    ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256 ECDHE-ECDSA-AES256-GCM-SHA384 ECDHE-ECDSA-AES128-SHA ECDHE-ECDSA-AES256-SHA ECDHE-ECDSA-AES128-SHA256 ECDHE-ECDSA-AES256-SHA384 ECDHE-RSA-AES128-GCM-SHA256 ECDHE-RSA-AES256-GCM-SHA384 ECDHE-RSA-AES128-SHA ECDHE-RSA-AES128-SHA256 ECDHE-RSA-AES256-SHA384 DHE-RSA-AES128-GCM-SHA256 DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES128-SHA DHE-RSA-AES256-SHA DHE-RSA-AES128-SHA256 DHE-RSA-AES256-SHA256 EDH-RSA-DES-CBC3-SHA";
}

server {
    listen 8000;
    server_name mysite;
    return 301 https://$host$request_uri;
}

Nginx should now get a certificate, for this i have found that i can use the letsencrypt-nginx-proxy-companion which would generate and manage the certificates for my sites.

My configuration for this companion is as follows:

letsencrypt-nginx-proxy-companion:
  image: jrcs/letsencrypt-nginx-proxy-companion
  volumes_from:
    - nginx
  volumes:
    - /var/run/docker.sock:/tmp/docker.sock:ro
    - nginx_certs:/etc/nginx/certs:rw
  environment:
    - NGINX_DOCKER_GEN_CONTAINER=nginx-gen

Every time I run the docker-compose up -d I get the following error message:

for letsencrypt-nginx-proxy-companion Cannot create container for service letsencrypt-nginx-proxy-companion: create \var\run\docker.sock: "\var\run\docker.sock" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed

Hopefully someone can help me fix this error.

Maxim
  • 105
  • 3
  • Frankly speaking, I have no clue what you are doing. Why are you using Docker Machine in the first place? Does it work on the default machine, but not on `my-machine`? Why are you showing Nginx configuration, but not showing the full `docker-compose.yml`? – techraf Jan 17 '17 at 10:54
  • I am using _docker-machine_ because it's stated [Here](https://docs.docker.com/compose/production/) that its a good solution for deploying a batch of containers to a single host. I am only showing the _nginx_ configuration because the rest was not relevant to the error and i'm only getting this error upon launching that particular container (as it's the only one using the `docker.sock` mapping) – Maxim Jan 17 '17 at 11:08
  • Possible duplicate of [Docker compose volumes invalid characters](https://serverfault.com/questions/757175/docker-compose-volumes-invalid-characters) – kenorb Mar 11 '19 at 22:12

0 Answers0