码迷,mamicode.com
首页 > 数据库 > 详细

This package contains mysql-server on ubuntu:14.04

时间:2017-12-05 14:26:48      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:mysql   doc   local   etc   server   4.0   cmd   1.0   ash   

【How to build】
cd /home/ops/work/demo/docker/aws/mysql
touch Dockerfile
docker build -t aws_mysql_image:v1.0 .

【Test】
docker run -id -p 8888:3306 --name aws_mysql_container aws_mysql_image:v1.0 /bin/bash
docker exec -it aws_mysql_container /bin/bash
service mysql start
mysql -h localhost -uroot -padminadmin

【Dockerfile】
FROM ubuntu:14.04
MAINTAINER jbding <jiangbo.ding@thomsonreuters.com>
RUN apt-get update
RUN apt-get install -y mysql-server

RUN /etc/init.d/mysql start \
&& mysql -uroot -e "grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘root‘;" \
&& mysql -uroot -e "grant all privileges on *.* to ‘root‘@‘localhost‘ identified by ‘root‘;"

RUN sed -Ei ‘s/^(bind-address|log)/#&/‘ /etc/mysql/my.cnf \
&& echo ‘skip-host-cache\nskip-name-resolve‘ | awk ‘{ print } $1 == "[mysqld]" && c == 0 { c = 1; system("cat") }‘ /etc/mysql/my.cnf > /tmp/my.cnf \
&& mv /tmp/my.cnf /etc/mysql/my.cnf

EXPOSE 3306
CMD ["/usr/bin/mysqld_safe"]

This package contains mysql-server on ubuntu:14.04

标签:mysql   doc   local   etc   server   4.0   cmd   1.0   ash   

原文地址:http://www.cnblogs.com/BigBra/p/7986567.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!