docker安装基本环境(M1Pro)

注意:/Users/william/develop/docker 这路径一定要换成自己的mac路径

一、配置Docker镜像

image.png

sudo systemctl daemon-reload
sudo systemctl restart docker
docker info

image.png

二、安装配置Mysql

docker search mysql
docker pull mysql
docker run -d -p 3307:3306 -v /Users/william/develop/docker/mysql/data:/var/lib/mysql -v /Users/william/develop/docker/mysql/my.cnf:/var/lib/conf.d/my.cnf -e MYSQL_ROOT_PASSWORD=root --restart=always --privileged=true --name docker-mysql mysql:latest

Navicat链接数据库可用:localhost 也可以使用: pconfig getifaddr en0 该命令获取自己的Ip地址

三、安装配置Nacos

docker pull nacos/nacos-server:v2.2.0-slim
docker run -p 8848:8848 -p 9848:9848 --name nacos -e MODE=standalone -e SPRING_DATASOURCE_PLATFORM=mysql -e MYSQL_SERVICE_HOST=192.168.124.42 -e MYSQL_SERVICE_PORT=3307 -e MYSQL_SERVICE_DB_NAME=ry-config -e MYSQL_SERVICE_USER=root -e MYSQL_SERVICE_PASSWORD=root -d nacos/nacos-server:v2.2.0-slim

注意MYSQL_SERVICE_HOST=192.168.124.42该段变量必须是本机mac的ip地址
image.png
访问地址:http://localhost:8848/nacos/index.html

四、安装配置Nginx

docker pull nginx
docker run --name nginx -p 8888:80 -d nginx

访问地址:http://localhost:8888/

五、安装配置redis

docker search redis
docker pull redis
docker run -p 6380:6379 --name redis -v /Users/william/develop/docker/redis/data:/data -v /Users/william/develop/docker/redis/conf/redis.conf:/etc/redis/redis.conf -d redis redis-server /etc/redis/redis.conf

六、安装配置RabbitMQ

docker pull rabbitmq:3.9
docker run --name rabbitmq --hostname local -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=admin -p 15672:15672 -p 5672:5672 -v /Users/william/develop/docker/rabbitmq/conf:/etc/rabbitmq -d rabbitmq:3.9
#进入容器
docker exec -it rabbitmq /bin/bash
#开启控制台插件
rabbitmq-plugins enable rabbitmq_management
#下载延迟队列插件
https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases
#使用docker cp命令复制到mq容器里面
docker cp /Users/william/develop/docker/rabbitmq/plugin/rabbitmq_delayed_message_exchange-3.9.0.ez rabbitmq:/plugins
#启动延迟队列插件
rabbitmq-plugins enable rabbitmq_delayed_message_exchange
#查询已安装插件
rabbitmq-plugins list

访问地址:http://localhost:15672
账号密码:admin

七、安装配置ElasticSearch

#创建一个网络
docker network create es-network
docker pull elasticsearch:7.17.6
echo "http.host: 0.0.0.0" > /Users/william/develop/docker/elasticsearch/config/elasticsearch.yml
docker run -p 9200:9200 -p 9300:9300 --network es-network --name elasticsearch -e  "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms64m -Xmx512m"  -v /Users/william/develop/docker/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /Users/william/develop/docker/elasticsearch/data:/usr/share/elasticsearch/data -v /Users/william/develop/docker/elasticsearch/plugins:/usr/share/elasticsearch/plugins -v /Users/william/develop/docker/elasticsearch/logs:/usr/share/elasticsearch/logs -d elasticsearch:7.17.6

访问地址:http://localhost:9200/

八、安装配置kibana

docker pull kibana:7.17.6
docker run -p 5601:5601 -v /Users/william/develop/docker/kibana/kibana.yml:/config/kibana.yml --network es-network --name kibana --restart=always -d kibana:7.17.6

image.png
访问地址:http://localhost:5601/

九、安装配置Sentinel

docker pull bladex/sentinel-dashboard:1.7.0
docker run --name sentinel -d  -p 8858:8858 bladex/sentinel-dashboard:1.7.0

访问地址:http://localhost:8858