简体   繁体   中英

Docker container crashes when nginx is restarted

Nginx is setup to run laravel, The problem only comes in when I try and restart nginx inside the container. Then it stops the container without logging anything in docker log .

Then on then the local machine gets a System program problem detected with _sbin_auplin.0.crash in /var/crash

This is the contents of the crash file

ProblemType: Crash
Architecture: amd64
Date: Thu Jul 13 13:29:33 2017
DistroRelease: Ubuntu 17.04
ExecutablePath: /sbin/auplink
ExecutableTimestamp: 1453488440
ProcCmdline: auplink /var/lib/docker/aufs/mnt/a33d46e2ea4abfea807913ac65b8f3af701f9f74462b4bfa305255bce7f3f523 flush
ProcCwd: /var/lib/docker/aufs/mnt/a33d46e2ea4abfea807913ac65b8f3af701f9f74462b4bfa305255bce7f3f523
ProcEnviron:
 LANG=en_ZA.UTF-8
 LANGUAGE=en_ZA:en
 PATH=(custom, no user)
ProcMaps:
 00400000-00403000 r-xp 00000000 08:11 2753135                            /sbin/auplink
 00602000-00603000 r--p 00002000 08:11 2753135                            /sbin/auplink
 00603000-00604000 rw-p 00003000 08:11 2753135                            /sbin/auplink
 00ac1000-00ae2000 rw-p 00000000 00:00 0                                  [heap]
 7fbe2f8b4000-7fbe2fa72000 r-xp 00000000 08:11 918608                     /lib/x86_64-linux-gnu/libc-2.24.so
 7fbe2fa72000-7fbe2fc71000 ---p 001be000 08:11 918608                     /lib/x86_64-linux-gnu/libc-2.24.so
 7fbe2fc71000-7fbe2fc75000 r--p 001bd000 08:11 918608                     /lib/x86_64-linux-gnu/libc-2.24.so
 7fbe2fc75000-7fbe2fc77000 rw-p 001c1000 08:11 918608                     /lib/x86_64-linux-gnu/libc-2.24.so
 7fbe2fc77000-7fbe2fc7b000 rw-p 00000000 00:00 0 
 7fbe2fc7b000-7fbe2fca1000 r-xp 00000000 08:11 918600                     /lib/x86_64-linux-gnu/ld-2.24.so
 7fbe2fe7a000-7fbe2fe7c000 rw-p 00000000 00:00 0 
 7fbe2fe9d000-7fbe2fea0000 rw-p 00000000 00:00 0 
 7fbe2fea0000-7fbe2fea1000 r--p 00025000 08:11 918600                     /lib/x86_64-linux-gnu/ld-2.24.so
 7fbe2fea1000-7fbe2fea2000 rw-p 00026000 08:11 918600                     /lib/x86_64-linux-gnu/ld-2.24.so
 7fbe2fea2000-7fbe2fea3000 rw-p 00000000 00:00 0 
 7fffe3da5000-7fffe3dc6000 rw-p 00000000 00:00 0                          [stack]
 7fffe3dea000-7fffe3dec000 r--p 00000000 00:00 0                          [vvar]
 7fffe3dec000-7fffe3dee000 r-xp 00000000 00:00 0                          [vdso]
 ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
ProcStatus:
 Name:  auplink
 Umask: 0022
 State: S (sleeping)
 Tgid:  24035
 Ngid:  0
 Pid:   24035
 PPid:  1183
 TracerPid: 0
 Uid:   0   0   0   0
 Gid:   0   0   0   0
 FDSize:    64
 Groups:     
 NStgid:    24035
 NSpid: 24035
 NSpgid:    1183
 NSsid: 1183
 VmPeak:        4356 kB
 VmSize:        4352 kB
 VmLck:        0 kB
 VmPin:        0 kB
 VmHWM:     1060 kB
 VmRSS:     1060 kB
 RssAnon:         84 kB
 RssFile:        976 kB
 RssShmem:         0 kB
 VmData:         188 kB
 VmStk:      132 kB
 VmExe:       12 kB
 VmLib:     1944 kB
 VmPTE:       32 kB
 VmPMD:       12 kB
 VmSwap:           0 kB
 HugetlbPages:         0 kB
 Threads:   1
 SigQ:  0/31496
 SigPnd:    0000000000000000
 ShdPnd:    0000000000000000
 SigBlk:    0000000000000000
 SigIgn:    0000000000000000
 SigCgt:    0000000000000000
 CapInh:    0000000000000000
 CapPrm:    0000003fffffffff
 CapEff:    0000003fffffffff
 CapBnd:    0000003fffffffff
 CapAmb:    0000000000000000
 NoNewPrivs:    0
 Seccomp:   0
 Cpus_allowed:  f
 Cpus_allowed_list: 0-3
 Mems_allowed:  00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001
 Mems_allowed_list: 0
 voluntary_ctxt_switches:   2
 nonvoluntary_ctxt_switches:    0
Signal: 11
Uname: Linux 4.10.0-26-generic x86_64
UserGroups: 
CoreDump: base64

This is the config that I'm using

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    # SSL configuration
    #
    # listen 443 ssl default_server;
    # listen [::]:443 ssl default_server;
    #
    # Note: You should disable gzip for SSL traffic.
    # See: https://bugs.debian.org/773332
    #
    # Read up on ssl_ciphers to ensure a secure configuration.
    # See: https://bugs.debian.org/765782
    #
    # Self signed certs generated by the ssl-cert package
    # Don't use them in a production server!
    #
    # include snippets/snakeoil.conf;

    root /app/public;

    # Add index.php to the list if you are using PHP
    index index.html index.htm index.nginx-debian.html index.php;

    server_name _;

        client_max_body_size 500M;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404 /index.php?$query_string;
    }

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;

        # With php7.0-cgi alone:
    #   fastcgi_pass 127.0.0.1:9000;
        # With php7.0-fpm:
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #   deny all;
    #}
}


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#   listen 80;
#   listen [::]:80;
#
#   server_name example.com;
#
#   root /var/www/example.com;
#   index index.html;
#
#   location / {
#       try_files $uri $uri/ =404;
#   }
#}

Thanks in advance for any help

You do not restart processes inside containers, you restart the container. See TIPS FOR DEPLOYING NGINX (OFFICIAL IMAGE) WITH DOCKER (original caps):

Since we do not have access to the command line of the NGINX container directly, we cannot use the nginx command to control NGINX. Fortunately NGINX can be controlled by signals and Docker provides kill command for sending signals to a container. For example, to reload the NGINX configuration run the command:

 docker kill -s HUP <container name> 

If you want to restart the NGINX process, restart the container by running the command:

 docker restart <container name> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM