window 中docker tool的安装:
Docker Toolbox修改镜像地址:
1.在Windows命令行执行docker-machine ssh [machine-name]进入VM bash2.sudo vi /var/lib/boot2docker/profile3.在--label provider=virtualbox的下一行添加--registry-mirror https://xxxxxxxx.mirror.aliyuncs.com14.重启docker服务:sudo /etc/init.d/docker restart或者重启VM:exit退出VM bash,在Windows命令行中执行docker-machine restartdocker 常用命令
docker stop $(docker ps -q)
docker rm $(docker ps -aq)停止并删除所有容器
docker stop $(docker ps -q) & docker rm $(docker ps -aq)删除所有镜像
docker rmi `docker images -q`
zabbix在docker中的安装
1.安装数据库mysql
docker run --name zabbix-mysql-server --hostname zabbix-mysql-server \-e MYSQL_ROOT_PASSWORD="123456" \-e MYSQL_USER="zabbix" \-e MYSQL_PASSWORD="123456" \-e MYSQL_DATABASE="zabbix" \-p 3306:3306 \-d mysql:5.7 \--character-set-server=utf8 --collation-server=utf8_bin
2.创建zabbix-server
这边选择的基础镜像是centos.可以通过切换tag来选择zabbix-server的镜像类型。具体类型如下:
如果不设置tag。默认基础镜像是alpine linux
docker run --name zabbix-server-mysql --hostname zabbix-server-mysql \--link zabbix-mysql-server:mysql \-e DB_SERVER_HOST="mysql" \-e MYSQL_USER="zabbix" \-e MYSQL_DATABASE="zabbix" \-e MYSQL_PASSWORD="123456" \-v /etc/localtime:/etc/localtime:ro \-v /data/docker/zabbix/alertscripts:/usr/lib/zabbix/alertscripts \-v /data/docker/zabbix/externalscripts:/usr/lib/zabbix/externalscripts \-p 10051:10051 \-d \zabbix/zabbix-server-mysql:centos-latest
3.安装web-nginx
docker run --name zabbix-web-nginx-mysql --hostname zabbix-web-nginx-mysql \--link zabbix-mysql-server:mysql \--link zabbix-server-mysql:zabbix-server \-e DB_SERVER_HOST="mysql" \-e MYSQL_USER="zabbix" \-e MYSQL_PASSWORD="123456" \-e MYSQL_DATABASE="zabbix" \-e ZBX_SERVER_HOST="zabbix-server" \-e PHP_TZ="Asia/Shanghai" \-p 8000:80 \-p 8443:443 \-d \zabbix/zabbix-web-nginx-mysql:centos-latest
最后访问浏览器
ip:8080.
用户名是admin,密码是zabbix