无法通过Docker和Vagrant安装MariaDB

当通过Dockerfile和Vagrant安装MariaDB时,我一直得到这个错误:

New password for the MariaDB "root" user: Use of uninitialized value $_[1] in join or string at /usr/share/perl5/Debconf/DbDriver/Stack.pm line 111. invoke-rc.d: policy-rc.d denied execution of stop. Use of uninitialized value $val in substitution (s///) at /usr/share/perl5/Debconf/Format/822.pm line 83, <GEN6> line 1. Use of uninitialized value $val in concatenation (.) or string at /usr/share/perl5/Debconf/Format/822.pm line 84, <GEN6> line 1. dpkg: error processing mariadb-server-10.0 (--configure): subprocess installed post-installation script returned error exit status 1 Setting up libhtml-template-perl (2.91-1) ... dpkg: dependency problems prevent configuration of mariadb-server: mariadb-server depends on mariadb-server-10.0 (= 10.0.15+maria-1~wheezy); however: Package mariadb-server-10.0 is not configured yet. dpkg: error processing mariadb-server (--configure): dependency problems - leaving unconfigured Errors were encountered while processing: mariadb-server-10.0 mariadb-server E: Sub-process /usr/bin/dpkg returned an error code (1) 

我尝试过的每个MariaDB都会发生这种情况(10.0.15,10.1.2)。

我的DockerFile:

 # vim:set ft=dockerfile: FROM debian:wheezy # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added RUN groupadd -r mysql && useradd -r -g mysql mysql # grab gosu for easy step-down from root RUN gpg --keyserver pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* \ && curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture)" \ && curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture).asc" \ && gpg --verify /usr/local/bin/gosu.asc \ && rm /usr/local/bin/gosu.asc \ && chmod +x /usr/local/bin/gosu \ && apt-get purge -y --auto-remove curl RUN apt-key adv --keyserver pool.sks-keyservers.net --recv-keys 199369E5404BD5FC7D2FE43BCBCB082A1BB943DB ENV MARIADB_MAJOR 10.0 ENV MARIADB_VERSION 10.0.15+maria-1~wheezy RUN echo "deb http://ftp.osuosl.org/pub/mariadb/repo/$MARIADB_MAJOR/debian wheezy main" > /etc/apt/sources.list.d/mariadb.list RUN apt-get update \ && apt-get install -y \ mariadb-server=$MARIADB_VERSION \ && rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/mysql \ && mkdir /var/lib/mysql \ && sed -ri 's/^(bind-address|skip-networking)/;\1/' /etc/mysql/my.cnf VOLUME /var/lib/mysql COPY docker-entrypoint.sh / ENTRYPOINT ["/docker-entrypoint.sh"] EXPOSE 3306 CMD ["mysqld"] 

我一直在寻找可能的解决scheme的谷歌,但我只能find没有任何解决scheme被发布的同样的问题的人。

我的stream浪者的定义是这样的:

 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.define "mariadb" do |v| v.vm.provider "docker" do |d| d.build_dir = "./docker/mariadb" d.name = "mariadb" d.ports = ["3306:3306"] d.vagrant_vagrantfile = "#{DOCKER_HOST_VAGRANTFILE}" d.env = { MYSQL_ROOT_PASSWORD: "root", MYSQL_USER: "root", MYSQL_PASS: "root" } end end end 

此外,当我尝试安装MySQL而不是MariaDB然后它的工作。 所以我的想法是在设置MariaDB的根密码时出现错误。 这让我想到的是,这个错误New password for the MariaDB "root" user:后面popupNew password for the MariaDB "root" user:最后它说它还没有被configuration。

也许问题是在VagrantFile呢? 然而,我试图改变envvariables的设置方式,并没有解决我的问题:(

如果有人能帮助我,我会很高兴。

更新:使用DockerFile: https : //github.com/docker-library/mariadb/blob/d06c367c4b199f91b36f5f6fabf8305282b8abac/10.0/Dockerfile (我更正了权限为755)

该解决scheme是添加更多的RAM到我的VirtualMachine并完全重新创build它(所以打开virtualbox和删除boot2docker机器)。 (感谢user2915097指出这一点!)