MYSQL installation errors with docker

I am trying to install mysql from a docker container on rhel6.
This is my dockerfile:

#HELLO
FROM rhel6
MAINTAINER xxxx

ADD ./perl /usr/bin/
RUN whereis perl
RUN ls -lrt /usr/bin/
RUN yum install http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm -y
RUN yum update
RUN yum install mysql
ADD ./startup.sh /opt/startup.sh

EXPOSE 3306

CMD ["/bin/bash", "/opt/startup.sh"]

This is my startup script:

  • Dockerfile RUN creates a fat layer even with cleanup
  • Cayley docker isn't writing data
  • Docker image of Java project
  • jenkins pipeline after run unit test karma script do not stop
  • Vagrant, Docker, Puppet, Chef
  • Run Redis with persistent storage using docker-compose
  • if [ ! -f /var/lib/mysql/ibdata1 ]; then
    
        mysql_install_db
    
        /usr/bin/mysqld_safe &
        sleep 10s
    
        echo "GRANT ALL ON *.* TO admin@'%' IDENTIFIED BY 'changeme' WITH GRANT OPTION; FLUSH PRIVILEGES" | mysql
    
        killall mysqld
        sleep 10s
    fi
    
    /usr/bin/mysqld_safe
    

    When i run my docker container, this is the error i am getting:

    [xxxx ~/mysql]$ sudo docker run -i -t -p 3306:3306 mysql12 /bin/bash
    bash-4.1# service mysqld start
    mysqld: unrecognized service
    bash-4.1# ls
    bin  boot  dev  etc  home  lib  lib64  lost+found  media  mnt  mysql-community-release-el6-5.noarch.rpm  opt  proc  root  run  sbin  selinux  srv  sys  tmp  usr  var
    

    This is the output i see when i run docker run -i -t

    [xxxx/mysql]$ sudo docker run -i -t 3e7ed89e7d4a 
    /opt/startup.sh: line 3: mysql_install_db: command not found
    /opt/startup.sh: line 5: /usr/bin/mysqld_safe: No such file or directory
    /opt/startup.sh: line 8: mysql: command not found
    mysqld: no process killed
    /opt/startup.sh: line 14: /usr/bin/mysqld_safe: No such file or directory
    

    I dont have much experience installing software. Am i missing anything in my steps?
    This has previously worked on centos.
    I believe with the procedure i followed mysqld is not getting installed.
    Can experts suggest me tips?

    MOST RECENT ERROR:

    ---> Package mysql-community-client.x86_64 0:5.6.22-2.el6 will be installed
    --> Processing Dependency: perl(Sys::Hostname) for package: mysql-community-client-5.6.22-2.el6.x86_64
    --> Processing Dependency: perl(IPC::Open3) for package: mysql-community-client-5.6.22-2.el6.x86_64
    --> Processing Dependency: perl(Getopt::Long) for package: mysql-community-client-5.6.22-2.el6.x86_64
    --> Processing Dependency: perl(File::Temp) for package: mysql-community-client-5.6.22-2.el6.x86_64
    --> Processing Dependency: perl(Fcntl) for package: mysql-community-client-5.6.22-2.el6.x86_64
    --> Processing Dependency: perl(Exporter) for package: mysql-community-client-5.6.22-2.el6.x86_64
    --> Processing Dependency: /usr/bin/perl for package: mysql-community-client-5.6.22-2.el6.x86_64
    ---> Package mysql-community-common.x86_64 0:5.6.22-2.el6 will be installed
    --> Processing Dependency: /usr/bin/perl for package: mysql-community-client-5.6.22-2.el6.x86_64
    --> Finished Dependency Resolution
    Error: Package: mysql-community-client-5.6.22-2.el6.x86_64 (mysql56-community)
               Requires: perl(Sys::Hostname)
    Error: Package: mysql-community-client-5.6.22-2.el6.x86_64 (mysql56-community)
               Requires: /usr/bin/perl
    Error: Package: mysql-community-client-5.6.22-2.el6.x86_64 (mysql56-community)
               Requires: perl(Getopt::Long)
    Error: Package: mysql-community-client-5.6.22-2.el6.x86_64 (mysql56-community)
               Requires: perl(IPC::Open3)
    Error: Package: mysql-community-client-5.6.22-2.el6.x86_64 (mysql56-community)
               Requires: perl(Exporter)
    Error: Package: mysql-community-client-5.6.22-2.el6.x86_64 (mysql56-community)
               Requires: perl(File::Temp)
    Error: Package: mysql-community-client-5.6.22-2.el6.x86_64 (mysql56-community)
               Requires: perl(Fcntl)
     You could try using --skip-broken to work around the problem
     You could try running: rpm -Va --nofiles --nodigest
    2015/01/16 10:23:43 The command [/bin/sh -c yum install mysql] returned a non-zero code: 1
    

  • How to set RAM memory of a Docker container by terminal or DockerFile
  • docker build and publish plugin usage
  • Docker Error getting events from daemon: EOF
  • Docker: Devices cgroup isn’t mounted (Ubuntu 16.04)
  • node-serialport failing on alpine linux
  • microservices & service discovery with random ports
  • One Solution collect form web for “MYSQL installation errors with docker”

    I am assuming you installed mysql-community-release-el6-5.noarch.rpm which I see is available at http://dev.mysql.com/downloads/repo/yum/.

    This is just a package to install the repositories as opposed to actual mysql. you should do

    yum install http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm -y
    yum update
    yum install mysql
    

    after installing that package or download the rpm from http://dev.mysql.com/downloads/mysql/:

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