@bergus
2016-01-14T14:50:19.000000Z
字数 1359
阅读 1637
docker
#Dockerfile
#
# MySQL Dockerfile
#
# https://github.com/dockerfile/mysql
#
# Pull base image.
FROM ubuntu:14.04
# Install MySQL.
RUN \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server && \
rm -rf /var/lib/apt/lists/* && \
sed -i 's/^\(bind-address\s.*\)/# \1/' /etc/mysql/my.cnf && \
sed -i 's/^\(log_error\s.*\)/# \1/' /etc/mysql/my.cnf && \
echo "mysqld_safe &" > /tmp/config && \
echo "mysqladmin --silent --wait=30 ping || exit 1" >> /tmp/config && \
echo "mysql -e 'GRANT ALL PRIVILEGES ON *.* TO \"root\"@\"%\" WITH GRANT OPTION;'" >> /tmp/config && \
bash /tmp/config && \
rm -f /tmp/config
# Define mountable directories.
VOLUME ["/etc/mysql", "/var/lib/mysql"]
# Define working directory.
WORKDIR /data
# Define default command.
CMD ["mysqld_safe"]
# Expose ports.
EXPOSE 3306
#shell
docker build -t ubuntu:mysql .
#Run mysqld-safe
docker run -d --name mysql -p 3306:3306 ubuntu:mysql
#Run mysql
docker run -it --rm --link mysql:mysql ubuntu:mysql bash -c 'mysql -h $MYSQL_PORT_3306_TCP_AD
zookeeper下载地址
http://apache.mirrors.pair.com/zookeeper/
docker与精彩的shell
0x1:删除所有标签为none的镜像
for i in sudo docker images|grep \<none\>|awk '{print $3}'
;do sudo docker rmi $i;done
或者
docker images|grep \|awk '{print $3}' | xargs docker rmi
0x2:Dockerfile换源的简单方法
Ubuntu添加:
RUN sed -i 's/http:\/\/archive.ubuntu.com\/ubuntu\//http:\/\/mirrors.163.com\/ubuntu\//g' /etc/apt/sources.list
0x3:查看docker的运行情况
docker stats (docker ps | awk '{if(NR>1) printNF}')
分享到评论
``