我想從rhel6上的Docker容器安裝mysql。 這是我dockerfile:Docker的MYSQL安裝錯誤
#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"]
這是我的啓動腳本:
if [ ! -f /var/lib/mysql/ibdata1 ]; then
mysql_install_db
/usr/bin/mysqld_safe &
sleep 10s
echo "GRANT ALL ON *.* TO [email protected]'%' IDENTIFIED BY 'changeme' WITH GRANT OPTION; FLUSH PRIVILEGES" | mysql
killall mysqld
sleep 10s
fi
/usr/bin/mysqld_safe
當我跑我的搬運工容器,這是我收到的錯誤:
[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
這是當我運行碼頭運行時看到的輸出-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
我沒有太多的安裝軟件的經驗。我在步驟中錯過了什麼? 這以前曾用於centos。 我相信隨着我跟隨mysqld的程序沒有得到安裝。 專家可以給我提示嗎?
最新的錯誤:
---> 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
你爲什麼不帶/斌/ bash的運行容器,這樣你可以探索,看看是否實際上是在安裝mysqld的?一旦你的圖像被構建,只需運行'docker run -t -i my_repo/my_image/bin/bash'。您現在可以用Bash在容器內部探索並查看缺少的內容。 – Eli
是的,我運行了運行命令。看看我編輯的問題。 – user892871