Aborted connection to db; docker-compose ruby & mysql images – Got an error reading communication packets

I’m using docker-compose to run a rails app with mysql db docker image.

The docker-compose build goes fine; the docker-compose up goes fine as well, even though there are some warnings (mysql image version issues)

  • Docker with a Virtual Sound Card for Stream Altering
  • Can not login docker via ssh
  • Gitlab.com runners: How do I install and run software from an external repos?
  • Can't npm install dependencies when building docker image
  • Docker: ping: unknown host yahoo.com
  • Configuring hazelcast on a docker overlay network
  • ...
    db_1 | MySQL init process done. Ready for start up.
    db_1 | [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
    ...
    db_1 | [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
    db_1 | [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
    db_1 | [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
    db_1 | Version: '5.7.10' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
    db_1 | Version: '5.7.10' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
    web_1 | [2016-02-11 18:38:10] INFO WEBrick 1.3.1
    web_1 | [2016-02-11 18:38:10] INFO ruby 2.2.0 (2014-12-25) [x86_64-linux]
    web_1 | [2016-02-11 18:38:10] INFO WEBrick::HTTPServer#start: pid=1 port=3000
    

    When I run migration commands docker-compose run web rake db:create|migrate on another terminal, I get this errors, in the current one (docker-compose up):

    db_1 | [Note] Aborted connection 2 to db: 'unconnected' user: 'root' host: '172.17.0.4' (Got an error reading communication packets)
    ...
    db_1 | [Note] Aborted connection 3 to db: 'unconnected' user: 'root' host: '172.17.0.4' (Got an error reading communication packets)
    

    This is my Dockerfile:

    FROM ruby:2.2.0
    RUN apt-get update -qq && apt-get install -y build-essential
    RUN mkdir /myapp
    WORKDIR /myapp
    ADD Gemfile /myapp/Gemfile
    ADD Gemfile.lock /myapp/Gemfile.lock
    RUN bundle install
    ADD . /myapp
    EXPOSE 3000
    

    This is my docker-compose.yml:

        db:
      image: mysql:latest
      environment:
        MYSQL_ROOT_PASSWORD: password
    web:
      build: .
      command: bundle exec rails s -p 3000 -b '0.0.0.0'
      volumes:
        - .:/myapp
      ports:
        - "3000:3000"
      links:
        - db
    

    This is my database.yml:

    default: &default
      adapter: mysql2
      pool: 5
      encoding: utf8
      host: db
      username: root
      password: password    
    development:
      <<: *default
      database: myapp_development
    test:
      <<: *default
      database: myapp_test
    

    For more details, see the entire scenario

  • Managing Docker images over time
  • cAdvisor: Reliably get container short name
  • jar file with arguments in docker
  • Docker: Internal UDP communication
  • Cannot start Spark in Docker container
  • How to solve “Rather than invoking init scripts…” on Ubuntu 14
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.