Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Containers always exit with code 0 #33

Open

Description

@bbergeron0

Hi, I can't get the container to run. After docker-compose up, it spit out some trace, then exit with code 0.

The traces:

nginx_1     | templating scripts from /etc/nginx/user.conf.d to /etc/nginx/conf.d
nginx_1     | Substituting variables 
nginx_1     |  -> /etc/nginx/user.conf.d/app.conf
nginx_1     | Done with startup
nginx_1     | Run certbot
nginx_1     | ++ parse_domains
nginx_1     | ++ for conf_file in /etc/nginx/conf.d/*.conf*
nginx_1     | ++ sed -n -r -e 's&^\s*ssl_certificate_key\s*\/etc/letsencrypt/live/(.*)/privkey.pem;\s*(#.*)?$&\1&p' /etc/nginx/conf.d/app.conf
nginx_1     | ++ xargs echo
nginx_1     | ++ for conf_file in /etc/nginx/conf.d/*.conf*
nginx_1     | ++ sed -n -r -e 's&^\s*ssl_certificate_key\s*\/etc/letsencrypt/live/(.*)/privkey.pem;\s*(#.*)?$&\1&p' /etc/nginx/conf.d/certbot.conf
nginx_1     | ++ xargs echo
nginx_1     | + for domain in $(parse_domains)
nginx_1     | + is_renewal_required service.domain.com
nginx_1     | + last_renewal_file=/etc/letsencrypt/live/service.domain.com/privkey.pem
nginx_1     | + '[' '!' -e /etc/letsencrypt/live/service.domain.com/privkey.pem ']'
nginx_1     | + one_week_sec=604800
nginx_1     | ++ date -d now +%s
nginx_1     | + now_sec=1602608722
nginx_1     | ++ stat -c %Y /etc/letsencrypt/live/service.domain.com/privkey.pem
nginx_1     | + last_renewal_sec=1602607046
nginx_1     | + last_renewal_delta_sec=1676
nginx_1     | + is_finshed_week_sec=603124
nginx_1     | + '[' 603124 -lt 0 ']'
nginx_1     | + echo 'Not run certbot for service.domain.com; last renewal happened just recently.'
nginx_1     | Not run certbot for service.domain.com; last renewal happened just recently.
nginx_1     | + auto_enable_configs
nginx_1     | + for conf_file in /etc/nginx/conf.d/*.conf*
nginx_1     | + keyfiles_exist /etc/nginx/conf.d/app.conf
nginx_1     | ++ parse_keyfiles /etc/nginx/conf.d/app.conf
nginx_1     | ++ sed -n -e 's&^\s*ssl_certificate_key\s*\(.*\);&\1&p' /etc/nginx/conf.d/app.conf
nginx_1     | + for keyfile in $(parse_keyfiles $1)
nginx_1     | + currentfile=/etc/letsencrypt/live/service.domain.com/privkey.pem
nginx_1     | + '[' '!' -f /etc/letsencrypt/live/service.domain.com/privkey.pem ']'
nginx_1     | + return 0
nginx_1     | + '[' conf = nokey ']'
nginx_1     | + for conf_file in /etc/nginx/conf.d/*.conf*
nginx_1     | + keyfiles_exist /etc/nginx/conf.d/certbot.conf
nginx_1     | ++ parse_keyfiles /etc/nginx/conf.d/certbot.conf
nginx_1     | ++ sed -n -e 's&^\s*ssl_certificate_key\s*\(.*\);&\1&p' /etc/nginx/conf.d/certbot.conf
nginx_1     | + return 0
nginx_1     | + '[' conf = nokey ']'
nginx_1     | + set +x
nginx_1     | /scripts/entrypoint.sh: line 48:    17 Hangup                  nginx -g "daemon off;"
srv_nginx_1 exited with code 0

My setup:

Docker-compose.yml:

version: "3.8"
services:
    nginx:
        image: staticfloat/nginx-certbot
        ports:
            - "80:80/tcp"
            - "443:443/tcp"
        environment:
            CERTBOT_EMAIL: email@bussiness.com
        volumes:
            - "./app.conf:/etc/nginx/user.conf.d/app.conf:ro"
            - "letsencrypt:/etc/letsencrypt"
        links:
            - "http-container"

    http-container:
        # ...

volumes:
    letsencrypt:

app.conf:

server {
    listen 443 ssl;
    server_name service.domain.net;
    ssl_certificate /etc/letsencrypt/live/service.domain.net/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/service.domain.net/privkey.pem;

    location / {
        proxy_pass http://http-container:8080;
    }
}

✅ No ISP restriction on port 80 or 443
✅ Port 80 and 443 are opened and forwarded correctly
My DNS is NoIP (A DDNS provider)

Everything seems in order, then where's the issue?

(Also is it possible to make the trace less verbose? It seems to print out every line of code it's executing, and I don't need that in my logs.)

Thanks

Activity

  1. methmu commented on Feb 4, 2021

    @methmu

    Hi I have the same issue, cant find a solution :`)

  2. jhagberg commented on Feb 26, 2021

    @jhagberg

    Yes same her.

  3. RY908 commented on Mar 4, 2021

    @RY908

    I had the same issue.
    When stopping the container, running docker-compose down -v instead of docker-compose down worked for me.
    It stopped exiting with code 0 when running docker-compose up.
    But I don't know if this is the right way to avoid this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions