Docker Community Forums

Share and learn in the Docker community.

Nginx docker issue while startup

Hi I run a docker container with nginx and got the following error:

2019/08/09 11:37:18 [emerg] 1#1: invalid number of arguments in “upstream” directive in /etc/nginx/conf.d/default.conf:61 nginx: [emerg] invalid number of arguments in “upstream” directive in /etc/nginx/conf.d/default.conf:61

My docker compose looks like this:

# @version 2018-01-15
# @author -----

version: "3.7"

networks:
  proxy:
    external: true

volumes:
  # curl https://raw.githubusercontent.com/jwilder/nginx-proxy/master/nginx.tmpl > /var/lib/docker/volumes/proxy_tmpl/_data/nginx.tmpl
  conf:
  vhost:
  certs:
  html:
  tmpl:

services:
  # Nginx proxy
  nginx:
    image: nginx
    networks:
      - proxy
    ports:
      - 80:80 
      - 443:443
    volumes:
      - conf:/etc/nginx/conf.d                    # nginx config
      - vhost:/etc/nginx/vhost.d                  # changed configuration of vhosts (needed by Let's Encrypt)
      - html:/usr/share/nginx/html                # challenge files
      - certs:/etc/nginx/certs:ro                 # Let's Encrypt certificates
      - /var/run/docker.sock:/tmp/docker.sock:ro  # docker service
    environment:
      - ENABLE_IPV6=true
    deploy:
      mode: global
      placement:
        constraints: [node.role == manager]
      restart_policy:
        condition: on-failure
        max_attempts: 5
        window: 120s
      resources:
        limits:
          memory: 256M
        reservations:
          memory: 32M
    labels:
      de.blubbbbb.meta.description: "Nginx"
      de.blubbbbb.meta.maintainer: "-----"
      de.blubbbbb.meta.version: "2018-01-15"
      com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: ""
    # see also: https://wiki.ssdt-ohio.org/display/rtd/Adjusting+nginx-proxy+Timeout+Configuration          

  # Docker-gen
  dockergen:
    # https://hub.docker.com/r/helder/docker-gen
    image: helder/docker-gen
    networks:
      - proxy
    volumes:
      - conf:/etc/nginx/conf.d
      - vhost:/etc/nginx/vhost.d
      - html:/usr/share/nginx/html
      - certs:/etc/nginx/certs:ro
      - tmpl:/etc/docker-gen/templates:ro     # docker-gen templates
      - /var/run/docker.sock:/tmp/docker.sock:ro    # docker service
    environment:
      ENABLE_IPV6: ""
    command: -notify "docker-label-sighup com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy" -watch -wait 10s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf
    deploy:
      mode: global
      placement:
        constraints: [node.role == manager]
      restart_policy:
        condition: on-failure
        max_attempts: 5
        window: 120s
      resources:
        limits:
          memory: 256M
        reservations:
          memory: 32M
    labels:
      de.blubbbbb.meta.description: "Docker-gen"
      de.blubbbbb.meta.maintainer: "-----"
      de.blubbbbb.meta.version: "2018-01-15"
      com.github.jrcs.letsencrypt_nginx_proxy_companion.docker_gen: ""

  # Lets Encrypt
  letsencrypt:
    image: jrcs/letsencrypt-nginx-proxy-companion
    networks:
      - proxy
    volumes:
      - conf:/etc/nginx/conf.d
      - vhost:/etc/nginx/vhost.d
      - html:/usr/share/nginx/html
      - certs:/etc/nginx/certs:rw
      - /var/run/docker.sock:/var/run/docker.sock:ro
    deploy:
      mode: global
      placement:
        constraints: [node.role == manager]
      restart_policy:
        condition: on-failure
        max_attempts: 5
        window: 120s
      resources:
        limits:
          memory: 256M
        reservations:
          memory: 32M
    labels:
      de.blubbbbb.meta.description: "Letsencrypt Nginx Proxy Companion"
      de.blubbbbb.meta.maintainer: "-----"
      de.blubbbbb.meta.version: "2018-01-15"

I run it like this:

 docker stack deploy proxy -c docker-compose.yml

What could be the issue? Thanks in advance.