docker-images - Dockerfile build install mysql的时候,弹出输入root密码之后,没反应?

查看:347
本文介绍了docker-images - Dockerfile build install mysql的时候,弹出输入root密码之后,没反应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

Dockerfile build 执行命令apt-get install mysql-server的时候,弹出输入root密码之后,输入秘密,回车,没反应啊!这怎么回事?

Dockfile:

FROM ubuntu:latest
RUN apt-get -qq update
RUN apt-get install -qqy nginx mysql-server php-mcrypt

解决方案

mysql是不可以直接这么安装的。

应该参照下面mysql官方镜像的做法:

ENV MYSQL_VERSION 8.0.0-dmr-1debian8

RUN echo "deb http://repo.mysql.com/apt/debian/ jessie mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list

# the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql)
# also, we set debconf keys to make APT a little quieter
RUN { \
        echo mysql-community-server mysql-community-server/data-dir select ''; \
        echo mysql-community-server mysql-community-server/root-pass password ''; \
        echo mysql-community-server mysql-community-server/re-root-pass password ''; \
        echo mysql-community-server mysql-community-server/remove-test-db select false; \
    } | debconf-set-selections \
    && apt-get update && apt-get install -y mysql-server="${MYSQL_VERSION}"

这篇关于docker-images - Dockerfile build install mysql的时候,弹出输入root密码之后,没反应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆