[关闭]
@bergus 2016-01-14T14:50:19.000000Z 字数 1359 阅读 1637

docker平台搭

docker


docker搭建mysql环境

  1. #Dockerfile
  2. #
  3. # MySQL Dockerfile
  4. #
  5. # https://github.com/dockerfile/mysql
  6. #
  7. # Pull base image.
  8. FROM ubuntu:14.04
  9. # Install MySQL.
  10. RUN \
  11. apt-get update && \
  12. DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server && \
  13. rm -rf /var/lib/apt/lists/* && \
  14. sed -i 's/^\(bind-address\s.*\)/# \1/' /etc/mysql/my.cnf && \
  15. sed -i 's/^\(log_error\s.*\)/# \1/' /etc/mysql/my.cnf && \
  16. echo "mysqld_safe &" > /tmp/config && \
  17. echo "mysqladmin --silent --wait=30 ping || exit 1" >> /tmp/config && \
  18. echo "mysql -e 'GRANT ALL PRIVILEGES ON *.* TO \"root\"@\"%\" WITH GRANT OPTION;'" >> /tmp/config && \
  19. bash /tmp/config && \
  20. rm -f /tmp/config
  21. # Define mountable directories.
  22. VOLUME ["/etc/mysql", "/var/lib/mysql"]
  23. # Define working directory.
  24. WORKDIR /data
  25. # Define default command.
  26. CMD ["mysqld_safe"]
  27. # Expose ports.
  28. EXPOSE 3306
  29. #shell
  30. docker build -t ubuntu:mysql .
  31. #Run mysqld-safe
  32. docker run -d --name mysql -p 3306:3306 ubuntu:mysql
  33. #Run mysql
  34. 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}')
分享到评论
``

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注