鍍金池/ 問答/C  Linux  數(shù)據(jù)庫/ dockerfile構(gòu)建mysql鏡像

dockerfile構(gòu)建mysql鏡像

使用dockerfile構(gòu)建mysql,鏡像構(gòu)建完成后,運行容器后,啟動mysql服務(wù)總是報錯

Fatal error: Can't open and lock privilege tables: Table storage engine for 'db' doesn't have this option

mysql安裝使用的官方的壓縮包

mysql-5.7.20-linux-glibc2.12-x86_64.tar.gz

dockerfile代碼如下:

# To build the images, exec the command below at the same directory
# docker build -t registry.cn-hangzhou.aliyuncs.com/lovekun/ubuntu-16.04:mysql-5.7.20 .

# Version mysql-5.7.20

# start server with the command bin/mysqld_safe --user=root &
 
FROM registry.cn-hangzhou.aliyuncs.com/lovekun/ubuntu-16.04:1.0.0

MAINTAINER qiuaikun@gmail.com

COPY mysql-5.7.20-linux-glibc2.12-x86_64.tar.gz /usr/local

RUN apt-get -y update \
    && apt-get -y install libaio1 \
    && apt-get -y install numactl \
    && cd /usr/local \
    && tar -zxvf mysql-5.7.20-linux-glibc2.12-x86_64.tar.gz \
    && ln -s /usr/local/mysql-5.7.20-linux-glibc2.12-x86_64 mysql  

ENV PATH $PATH:/usr/local/mysql/bin

COPY my.cnf /usr/local/mysql

RUN cd /usr/local/mysql \
    && bin/mysqld --defaults-file=/usr/local/mysql/my.cnf  --initialize-insecure --user=root 
回答
編輯回答
不討喜

建議使用官方鏡像,或者mariadb可能是更好的選擇
https://store.docker.com/imag...

2017年12月14日 13:06