debconf: Предупреждение "паролей" DbDriver: не удалось открыть /var/cache/debconf/passwords.dat: разрешение отклонено - PullRequest
0 голосов
/ 01 мая 2020

Я получаю это при создании образа docker.

debconf: DbDriver "passwords" warning: could not open /var/cache/debconf/passwords.dat: Permission denied
debconf: DbDriver "passwords" warning: could not write /var/cache/debconf/passwords.dat-new: Permission denied
debconf: DbDriver "passwords" warning: /var/cache/debconf/passwords.dat-new is locked by another process: Bad file descriptor
debconf: DbDriver "passwords" warning: could not write /var/cache/debconf/passwords.dat-new: Bad file descriptor
debconf: DbDriver "passwords" warning: could not write /var/cache/debconf/passwords.dat-new: Bad file descriptor
debconf: DbDriver "passwords" warning: could not flush /var/cache/debconf/passwords.dat-new: Invalid argument
debconf: DbDriver "passwords" warning: could not sync /var/cache/debconf/passwords.dat-new: Invalid argument
debconf: DbDriver "passwords" warning: rename failed: No such file or directory
debconf: DbDriver "templatedb": could not write /var/cache/debconf/templates.dat-new: Permission denied

Ошибка, которую я получаю, согласуется с debconf, а не с sudo. В этом конкретном образе я пытаюсь установить mysql -сервер с нуля и даю пароль root в качестве аргумента сборки.

FROM ubuntu:16.04

ARG MYSQL_PWD_INSTALLATION
RUN apt-get update -y \
      && apt-get -y install sudo
ENV user ujala

RUN useradd -m -d /home/${user} ${user} && \
    chown -R ${user} /home/${user} && \
    adduser ${user} sudo && \
    echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

USER ${user}

WORKDIR /home/${user}

RUN sudo apt-get update -y \
    && { \
            echo "mysql-server mysql-server/root_password password $MYSQL_PWD_INSTALLATION"; \
            echo "mysql-server mysql-server/root_password_again password $MYSQL_PWD_INSTALLATION"; \
    } | debconf-set-selections \
    && sudo apt-get install mysql-server -y

RUN set -x \
    && echo "[mysqld]" >> /etc/mysql/my.cnf \
    && echo "bind-address = 0.0.0.0" >> /etc/mysql/my.cnf \
    && echo "default-authentication-plugin=mysql_native_password" >> /etc/mysql/my.cnf \
    && chown mysql:mysql -R /var/lib/mysql 

VOLUME /var/lib/mysql
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]

EXPOSE 3306 33060
CMD ["mysqld"]
...