Docker容器上的Mysql安装

前端之家收集整理的这篇文章主要介绍了Docker容器上的Mysql安装前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我试图运行mysql修改后的ubuntu映像,其中包括安装Node.js和使用下面的docker文件安装基本的MysqL

# Memcached

# use the ubuntu base image provided by dotCloud
FROM ubuntu/MysqLbase
MAINTAINER Hitesh

# make sure the package repository is up to dat//e
#RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
#RUN apt-get update

#RUN apt-get install -y MysqL-client
#ENTRYPOINT ["wc","-l"]
#ENTRYPOINT ["echo","running"]
ENTRYPOINT MysqLd_safe & sleep 10
#RUN MysqL
RUN echo "[MysqLd]"                       >/etc/MysqL/conf.d/docker.cnf
RUN echo "bind-address   = 0.0.0.0"      >>/etc/MysqL/conf.d/docker.cnf
RUN echo "innodb_flush_method = O_DSYNC" >>/etc/MysqL/conf.d/docker.cnf
RUN echo "skip-name-resolve"             >>/etc/MysqL/conf.d/docker.cnf
RUN echo "init_file = /etc/MysqL/init"   >>/etc/MysqL/conf.d/docker.cnf
RUN echo "GRANT ALL ON *.* TO root@'%'" >/etc/MysqL/init

USER root

EXPOSE 3306

使用以下命令运行此服务器时

sudo docker run -p 3306:13306 MysqL/dockerfiletest

遇到以下错误

ERROR 2002 (HY000): Can't connect to local MysqL server through socket '/var/run/MysqLd/MysqLd.sock' (2)

有人可以建议在这里需要更改的内容.我想使用此容器与其他容器链接,该容器本质上运行我的node.js应用程序.

最佳答案
更新:你应该检查暴露的端口号 – 在你的例子中是memcached(11211)的端口,而不是MysqL的端口(3306).

无论如何,我认为你可能需要修改你的Dockerfile – 在入口点删除不必要的睡眠:

ENTRYPOINT ["/usr/bin/MysqLd_safe"]

然后你应该以这种方式启动你的容器(守护进程模式):

root@machine:/# docker run -d -p 3306:

猜你在找的Docker相关文章