"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 <[email protected]>
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} ' = = ' [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