mysql docker container crashes often

I am using mariadb and wordpress container. But this error keeps on happening. How can I ensure that this crash does not happen anymore ? Am I being attacked ? Or is it a problem that occurs to other people ? How can I attach to mariadb and have access to the shell and try to find out what goes on inside mariadb container?

See below the messages logged after every crash… There seems to be a high number of page hits as well. page visits go up to 20.000 to 60.000 hits on pages. These seem to be the work of crawlers, bots. Not sure if these are malicious attacks.

  • cannot access Docker remote registry
  • Docker: Cronjob is not working
  • Keep DNS resolution of a stopped docker container in docker DNS
  • How to install docker in Jenkins without root privileges?
  • kubernetes and debugging it in general
  • docker-compose fails to resolve service hostname
  • Any help on how to go about dealing with this problem?

    I have mariadb, wordpress and phpmyadmin working in three docker containers under ubuntu 14 on digital ocean.
    Here are the crash messages:

    [1668002.926214] Out of memory: Kill process 16765 (mysqld) score 176 or sacrifice child [1668002.935614] killed process 16765 (mysqld) total-vm:1012836kb, anon-rss:178840kb, file-rss:0kb
    [1668040.992415] killed process 22570 (php5-fpm) total-vm:418044kB, anon-rss:145392kB, file-rss: 20624kB

    New York Server:
    [1225007.977126] Out of memory: Kill process 3161 (mysqld) score 245 or sacrifice child [
    1225007.985657] killed process 3161 (mysqld) total-vm: 977148kb, anon-rss:122488kb, file-rss:0kB)

    Frankfurt server
    [1632264.057873] Out of memory: Kill process 22421 (mysqld) score 246 or sacrifice child
    [1632264.067530] Killed process 22421 (mysqld) total-vm: 1005228kb, anon-rss:249328kb, file-rss:0kb

  • How to add my container's hostname to /etc/hosts?
  • Cannot connect to mongodb instance from docker: Connection refused
  • How make a cluster of CoreOS on my local infrastructure?
  • What are default credentials for docker cloud Ubuntu node?
  • Copy all files with given extension from docker container
  • Redis in docker starts/restarts multiple times?
  • One Solution collect form web for “mysql docker container crashes often”

    The official MySQL images on Docker Hub use a configuration that’s recommended by MySQL. Basically, the default configuration is tuned for performance, and is intended for running MySQL on a dedicated server, with lots of memory (multiple gigabytes).

    Tune MySQL settings based on your requirements and available resources

    When running MySQL in a container on a small DigitalOcean droplet (512MB, 1GB), you will have to modify the default settings to fit your situation. For example; limit the maximum amount of simultaneous connections, less query cache, etc.

    Also note that, by default, DigitalOcean droplets don’t have swap configured, which means that if they run out of memory, they cannot use the SSD to swap. It’s important to configure Swap on those droplets so that MySQL doesn’t crash if it’s temporarily needing more memory (e.g. when re-idexing the database).

    This article describes how to configure a Swap partition on Ubuntu 14.04 on DigitalOcean; How To Add Swap on Ubuntu 14.04

    The following issues on the official MySQL Docker repository contain some hints for tuning MySQL settings for “performance” or “memory efficiency”;

    • mysql immediately stops after running
    • Container with MySQL crash almost every day

    The MySQL readme on Docker Hub describes how to use a custom configuration file; “Using a custom MySQL configuration file”

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.