0
votes

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.

upstream part from conf

upstream  {
                                # Cannot connect to network of this container
                                server 127.0.0.1 down;
                                # Cannot connect to network of this container
                                server 127.0.0.1 down;
                                # Cannot connect to network of this container
                                server 127.0.0.1 down;
                                ## Can be connected with "proxy" network
                        # tools_adminer.1.n1j3poc9mo507somuhyf7adrd
                        server 10.0.35.3:8080;
                                # Cannot connect to network of this container
                                server 127.0.0.1 down;
                                # Cannot connect to network of this container
                                server 127.0.0.1 down;
}
1
you need to show your nginx config /etc/nginx/conf.d/default.conf - Scott Stensland
manually run the nginx container and test if the nginx configs are ok. May be that would help you figure out the issue. Looks like issue in the nginx conf - Tara Prasad Gurung
@ScottStensland that is auto generated file I think - LinPy
When I run the container manually It stops immideatly atfer startup. same like with compose - Felix

1 Answers

0
votes

In my case there was an adminer docker which has blocked nginx