1

通过 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)都会发生这种情况。

我的 Docker 文件:

# 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"]

我一直在谷歌上寻找可能的解决方案,但我只能找到遇到同样问题的人而没有发布任何解决方案。

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

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 的 Root 密码时出错。让我想到的是,这个错误在该行之后弹出,New password for the MariaDB "root" user:最后它说它还没有配置。

也许问题出在 VagrantFile 中?但是我尝试更改设置环境变量的方式,但这并没有解决我的问题:(

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

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

4

1 回答 1

1

解决方案是向我的 VirtualMachine 添加更多 RAM 并完全重新创建它(因此打开 virtualbox 并删除 boot2docker 机器)。(感谢 user2915097 指出这一点!)

于 2015-01-20T14:52:33.377 回答