Docker Community Forums

Share and learn in the Docker community.

1.11.1-beta10 (build: 6662) Mysql db migration schema but no data

beta

(Stevegroom) #1

Expected behaviour

Expect database to have schema and records

Actual behaviour

mysql official container should load the mysql dumps from the container’s source directory.
The dump is read and the schema created, but no records are loaded.

Information

  • the output of:
    • pinata diagnose -u on OSX
OS X: version 10.11.4 (build: 15E65)
Docker.app: version v1.11.1-beta10
Running diagnostic tests:
[OK]      docker-cli
[OK]      Moby booted
[OK]      driver.amd64-linux
[OK]      vmnetd
[OK]      osxfs
[OK]      db
[OK]      slirp
[OK]      menubar
[OK]      environment
[OK]      Docker
[OK]      VT-x
Docker logs are being collected into /tmp/20160505-113402.tar.gz
Most specific failure is: No error was detected
Your unique id is: D8458696-5724-481F-A1E7-CE5B4577CDE1
Please quote this in all correspondence.
Dibbler:britishgt steve$ 
  • a reproducible case if this is a bug, Dockerfiles FTW

  • host distribution and version
    OSX 10.11.4

docker-compose.yml

services:
  web:
    build: nginx

    networks:
      - outside
      - default

    ports:
      - "8001:80"
      
    volumes:
      - ./src/public:/usr/share/nginx/html:ro
      - ./src/public/temp:/usr/share/nginx/html/temp:rw

      - ./nginx/snippets:/etc/nginx/snippets
      - ./nginx/sites-enabled:/etc/nginx/sites-enabled
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf

    links:
      - php

  php:
    build: php

    networks:
      - default

    ulimits:
      nproc: 65535
      nofile:
        soft: 20000
        hard: 40000

    mem_limit: 4000000000
    memswap_limit: 8000000000
    privileged: true

    volumes:
      - ./src/public:/usr/share/nginx/html
      # On the php service run ps aux | grep php-fpm to see where the php-fpm.conf is found
      #decided to stop sharing these files and use the Dockerfile to create the required entries
      #- ./php/conf:/usr/local/etc
      - ./files:/files
    links:
      - db

  db:
    build: mysql

    networks:
      - default

    mem_limit: 4000000000
    memswap_limit: 8000000000
    privileged: true

    volumes:
      - ./src/public/temp:/usr/share/nginx/html/temp
      - ./mysql/db:/var/lib/mysql
      - ./mysql/source:/home/mysql
      - ./mysql/source:/docker-entrypoint-initdb.d

    environment:
      - MYSQL_DATABASE=britishgt
      - MYSQL_USER=root
      - MYSQL_ALLOW_EMPTY_PASSWORD=yes
      - DB_NAME=britishgt
      - DB_USER=root
      - DB_PASS=whatdoyouthink?

# Add a phpmyadmin container when needed.
# http://docker.dev:8000 to launch
# credentials:

  phpmyadmin:
    image: nazarpc/phpmyadmin
    ports:
    - "9001:80"
    links:
    - db:mysql

networks:
  outside:
    external:
#      name: bgtnetwork
      name: britishgt_default

Dockerfile

MAINTAINER Steve Groom "stevereg1@groom.ch"

RUN echo "[client]" >> /etc/mysql/my.cnf \
 && echo "default-character-set=utf8mb4" >> /etc/mysql/my.cnf \
 && echo "[mysql]" >> /etc/mysql/my.cnf \
 && echo "default-character-set=utf8mb4" >> /etc/mysql/my.cnf \
 && echo "[mysqld]" >> /etc/mysql/my.cnf \
 && echo "collation-server=utf8mb4_unicode_ci" >> /etc/mysql/my.cnf \
 && echo "init-connect='SET NAMES utf8'" >> /etc/mysql/my.cnf \
 && echo "character-set-server=utf8mb4" >> /etc/mysql/my.cnf \
 && echo "secure-file-priv = '' " >> /etc/mysql/my.cnf
# && echo "MYSQL_ALLOW_EMPTY_PASSWORD=1" >> /etc/mysql/my.cnf

# this need to stay the same for script to work
ENV MYSQL_USER mysql

COPY ./localdb-run.sh /
RUN chmod 755 /localdb-run.sh

ENTRYPOINT ["/localdb-run.sh"]

####CMD ["mysqld --port 3386"]

###CMD ["bash"]

localdb-run.sh

set -e

# Script to workaround docker-machine/boot2docker OSX host volume issues: https://github.com/docker-library/mysql/issues/99

echo '* Working around permission errors locally by making sure that "mysql" uses the same uid and gid as the host volume'
TARGET_UID=$(stat -c "%u" /var/lib/mysql)
echo '-- Setting mysql user to use uid '$TARGET_UID
usermod -o -u $TARGET_UID mysql || true
TARGET_GID=$(stat -c "%g" /var/lib/mysql)
echo '-- Setting mysql group to use gid '$TARGET_GID
groupmod -o -g $TARGET_GID mysql || true
echo
echo '* Starting MySQL'
chown -R mysql:root /var/run/mysqld/
/entrypoint.sh mysqld --user=mysql --console

Steps to reproduce the behavior


rm -rf mysql/db 

docker-compose up 

Resulting database is created but empty - no space.

LOG:

Starting britishgt_db_1
Starting britishgt_phpmyadmin_1
Starting britishgt_php_1
Starting britishgt_web_1
Attaching to britishgt_db_1, britishgt_php_1, britishgt_phpmyadmin_1, britishgt_web_1
db_1          | * Working around permission errors locally by making sure that "mysql" uses the same uid and gid as the host volume
phpmyadmin_1  | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.19.0.4. Set the 'ServerName' directive globally to suppress this message
php_1         | [05-May-2016 09:28:04] WARNING: Nothing matches the include pattern '/usr/local/etc/php-fpm/conf.d/*' from /usr/local/etc/php-fpm.conf at line 10.
db_1          | -- Setting mysql user to use uid 0
php_1         | [05-May-2016 09:28:04] NOTICE: fpm is running, pid 1
php_1         | [05-May-2016 09:28:04] NOTICE: ready to handle connections
phpmyadmin_1  | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.19.0.4. Set the 'ServerName' directive globally to suppress this message
db_1          | usermod: no changes
phpmyadmin_1  | [Thu May 05 09:28:04.339326 2016] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.10 (Debian) PHP/5.6.18 configured -- resuming normal operations
db_1          | -- Setting mysql group to use gid 0
phpmyadmin_1  | [Thu May 05 09:28:04.339405 2016] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
db_1          | 
db_1          | * Starting MySQL
db_1          | Initializing database
db_1          | 2016-05-05T09:28:03.697904Z 0 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
db_1          | 2016-05-05T09:28:04.766169Z 0 [Warning] InnoDB: New log files created, LSN=45790
db_1          | 2016-05-05T09:28:04.971887Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
db_1          | 2016-05-05T09:28:05.034037Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: aba931b4-12a3-11e6-a35b-0242ac130002.
db_1          | 2016-05-05T09:28:05.037201Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
db_1          | 2016-05-05T09:28:05.041567Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
db_1          | 2016-05-05T09:28:05.217374Z 1 [ERROR] InnoDB: posix_fallocate(): Failed to preallocate data for file ./mysql/plugin.ibd, desired size 32768 bytes. Operating system error number 38. Check that the disk is not full or a disk quota exceeded. Make sure the file system supports this function. Some operating system error numbers are described at http://dev.mysql.com/doc/refman/5.7/en/ operating-system-error-codes.html
db_1          | 2016-05-05T09:28:05.245422Z 1 [ERROR] InnoDB: posix_fallocate(): Failed to preallocate data for file ./mysql/servers.ibd, desired size 32768 bytes. Operating system error number 38. Check that the disk is not full or a disk quota exceeded. Make sure the file system supports this function. Some operating system error numbers are described at http://dev.mysql.com/doc/refman/5.7/en/ operating-system-error-codes.html

(b.enoit.be) #2

I think I have quite the same issue Posix_fallocate() issues


(Stevegroom) #3

Update: I have two almost identical configurations of this that are working.

On the original Docker machine / VirtualBox system I had three websites each running with the same configuration - a docker-compose file with NGINX, PHP and MYSQL containers. Three folders, each with docker-compose.yml and linked Dockerfiles. The only difference is the database and some of the source files and images.

After the migration to the 1.11.1 beta, two are working and one (see above) is not. If I switch mack to virtual box all three are working.

Where should I now look to try to determine the difference?

Steve