Docker上的Wordpress:mysqld进入FATAL状态,太多开始重试太快

时间:2017-03-08 07:07:02

标签: mysql wordpress docker supervisord docker-volume

我能够使用默认设置运行带有Wordpress的Docker容器。

然后我在主机上共享了卷:

-v ~/workspace/mysql:/var/lib/mysql

-v ~/workspace/www:/usr/share/nginx/www

这些参数会导致supervisord退出正在运行的mysql进程而无需其他信息:

  

2017-03-08 06:49:59,081 INFO退出:mysqld(退出状态1;不是   预期)

     

2017-03-08 06:50:00,082 INFO放弃了:mysqld进入FATAL   州,太多开始重试太快

使用以下命令将mysql日志文件清空:

$ docker exec CONTAINER_ID cat /var/log/mysql.log
$ docker exec CONTAINER_ID cat /var/log/mysql.err

控制台:

$ sudo docker run -p 8082:80 -v ~/workspace/mysql:/var/lib/mysql -v ~/workspace/www:/usr/share/nginx/www --name docker-wordpress-nginx eugeneware/docker-wordpress-nginx
/usr/local/lib/python2.7/dist-packages/supervisor-3.1.3-py2.7.egg/supervisor/options.py:296: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
  'Supervisord is running as root and it is searching '
2017-03-08 06:49:51,793 CRIT Supervisor running as root (no user in config file)
2017-03-08 06:49:51,801 INFO RPC interface 'supervisor' initialized
2017-03-08 06:49:51,801 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2017-03-08 06:49:51,801 INFO supervisord started with pid 5
2017-03-08 06:49:52,803 INFO spawned: 'stdout' with pid 8
2017-03-08 06:49:52,805 INFO spawned: 'php5-fpm-log' with pid 9
2017-03-08 06:49:52,806 INFO spawned: 'nginx' with pid 10
2017-03-08 06:49:52,808 INFO spawned: 'mysqld' with pid 11
2017-03-08 06:49:52,814 INFO spawned: 'php5-fpm' with pid 12
2017-03-08 06:49:52,822 INFO exited: php5-fpm-log (exit status 1; not expected)
2017-03-08 06:49:52,933 INFO exited: mysqld (exit status 1; not expected)
2017-03-08 06:49:53,934 INFO success: stdout entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-03-08 06:49:53,935 INFO spawned: 'php5-fpm-log' with pid 31
2017-03-08 06:49:53,936 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-03-08 06:49:53,937 INFO spawned: 'mysqld' with pid 32
2017-03-08 06:49:53,938 INFO success: php5-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
php5-fpm-log stderr | tail: cannot open '/var/log/php5-fpm.log' for reading: No such file or directory
mysqld stderr | 170308  6:49:52 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
mysqld stderr | 170308  6:49:52 [Note] /usr/sbin/mysqld (mysqld 5.5.43-0ubuntu0.14.04.1) starting as process 11 ...
php5-fpm-log stdout | [08-Mar-2017 06:49:52] NOTICE: fpm is running, pid 12
[08-Mar-2017 06:49:52] NOTICE: ready to handle connections
[08-Mar-2017 06:49:52] NOTICE: systemd monitor interval set to 10000ms
mysqld stderr | 170308  6:49:53 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
mysqld stderr | 170308  6:49:53 [Note] /usr/sbin/mysqld (mysqld 5.5.43-0ubuntu0.14.04.1) starting as process 32 ...
2017-03-08 06:49:53,985 INFO exited: mysqld (exit status 1; not expected)
2017-03-08 06:49:54,987 INFO success: php5-fpm-log entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-03-08 06:49:55,989 INFO spawned: 'mysqld' with pid 44
mysqld stderr | 170308  6:49:55 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
170308  6:49:55 [Note] /usr/sbin/mysqld (mysqld 5.5.43-0ubuntu0.14.04.1) starting as process 44 ...
2017-03-08 06:49:56,033 INFO exited: mysqld (exit status 1; not expected)
2017-03-08 06:49:59,038 INFO spawned: 'mysqld' with pid 56
mysqld stderr | 170308  6:49:59 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
170308  6:49:59 [Note] /usr/sbin/mysqld (mysqld 5.5.43-0ubuntu0.14.04.1) starting as process 56 ...
2017-03-08 06:49:59,081 INFO exited: mysqld (exit status 1; not expected)
2017-03-08 06:50:00,082 INFO gave up: mysqld entered FATAL state, too many start retries too quickly

Dockerfile(GitHub link):

FROM ubuntu:14.04
MAINTAINER Eugene Ware <eugene@noblesamurai.com>

# Keep upstart from complaining
RUN dpkg-divert --local --rename --add /sbin/initctl
RUN ln -sf /bin/true /sbin/initctl

# Let the conatiner know that there is no tty
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update
RUN apt-get -y upgrade

# Basic Requirements
RUN apt-get -y install mysql-server mysql-client nginx php5-fpm php5-mysql php-apc pwgen python-setuptools curl git unzip

# Wordpress Requirements
RUN apt-get -y install php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-sqlite php5-tidy php5-xmlrpc php5-xsl

# mysql config
RUN sed -i -e"s/^bind-address\s*=\s*127.0.0.1/bind-address = 0.0.0.0/" /etc/mysql/my.cnf

# nginx config
RUN sed -i -e"s/keepalive_timeout\s*65/keepalive_timeout 2/" /etc/nginx/nginx.conf
RUN sed -i -e"s/keepalive_timeout 2/keepalive_timeout 2;\n\tclient_max_body_size 100m/" /etc/nginx/nginx.conf
RUN echo "daemon off;" >> /etc/nginx/nginx.conf

# php-fpm config
RUN sed -i -e "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" /etc/php5/fpm/php.ini
RUN sed -i -e "s/upload_max_filesize\s*=\s*2M/upload_max_filesize = 100M/g" /etc/php5/fpm/php.ini
RUN sed -i -e "s/post_max_size\s*=\s*8M/post_max_size = 100M/g" /etc/php5/fpm/php.ini
RUN sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php5/fpm/php-fpm.conf
RUN sed -i -e "s/;catch_workers_output\s*=\s*yes/catch_workers_output = yes/g" /etc/php5/fpm/pool.d/www.conf
RUN find /etc/php5/cli/conf.d/ -name "*.ini" -exec sed -i -re 's/^(\s*)#(.*)/\1;\2/g' {} \;

# nginx site conf
ADD ./nginx-site.conf /etc/nginx/sites-available/default

# Supervisor Config
RUN /usr/bin/easy_install supervisor
RUN /usr/bin/easy_install supervisor-stdout
ADD ./supervisord.conf /etc/supervisord.conf

# Install Wordpress
ADD https://wordpress.org/latest.tar.gz /usr/share/nginx/latest.tar.gz
RUN cd /usr/share/nginx/ && tar xvf latest.tar.gz && rm latest.tar.gz
RUN mv /usr/share/nginx/html/5* /usr/share/nginx/wordpress
RUN rm -rf /usr/share/nginx/www
RUN mv /usr/share/nginx/wordpress /usr/share/nginx/www
RUN chown -R www-data:www-data /usr/share/nginx/www

# Wordpress Initialization and Startup Script
ADD ./start.sh /start.sh
RUN chmod 755 /start.sh

# private expose
EXPOSE 3306
EXPOSE 80

# volume for mysql database and wordpress install
VOLUME ["/var/lib/mysql", "/usr/share/nginx/www"]

CMD ["/bin/bash", "/start.sh"]

0 个答案:

没有答案