1.获取镜像
docker pull nacos/nacos-server
2.查看
docker images
3.创建nacos 容器并运行
docker run \
--name nacos -d \
-p 8848:8848 \
--privileged=true \
--restart=always \
-e JVM_XMS=256m \
-e JVM_XMX=256m \
-e MODE=standalone \
-e PREFER_HOST_MODE=hostname \
nacos/nacos-server
docker pull mysql
docker images
mkdir -p /home/docker/mysql/conf && mkdir -p /home/docker/mysql/datadir
cd /home/docker/mysql/conf
vim my.cnf
# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# The MySQL Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
secure-file-priv= NULL
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Custom config should go here
!includedir /etc/mysql/conf.d/
docker run --name mysql8 \
-p 3306:3306 -e MYSQL_ROOT_PASSWORD=root \
--mount type=bind,src=/home/docker/mysql/conf/my.cnf,dst=/etc/mysql/my.cnf \
--mount type=bind,src=/home/docker/mysql/datadir,dst=/var/lib/mysql \
--restart=on-failure:3 \
-d mysql
# 进入mysql 容器
docker exec -it mysql8 bash
# 进入mysql
mysql -uroot -p
# 输入原本设置的密码root
# 修改远程登录root密码
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'pwd';
# 修改登录权限
grant all privileges on *.* to 'root'@'%' with grant option;
# 刷新数据库
flush privileges;
# 退出数据库
exit
# 退出容器
exit
设置mysql开机自启
docker update mysql8 --restart=always
docker pull redis
mkdir -p /root/redis/data /root/redis/conf
在/root/redis/conf目录中创建文件 redis.conf
touch redis.conf
因为需要redis的配置文件,直接去redis的官方去下载一个redis里面的配置文件即可
redis中文官方网站:http://www.redis.cn/download.html
bind 127.0.0.1 #注释掉这部分,使redis可以外部访问
daemonize no #用守护线程的方式启动
requirepass 你的密码 #给redis设置密码
appendonly yes #redis持久化 默认是no
tcp-keepalive 300 #防止出现远程主机强迫关闭了一个现有的连接的错误 默认是300
docker run -p 6379:6379 --name redis -v /root/redis/conf/redis.conf:/etc/redis/redis.conf -v /root/redis/data:/data -d redis redis-server /etc/redis/redis.conf --appendonly yes
-d 后台运行
-p 端口映射到主机的端口
-v 将主机目录挂载到容器的目录
**redis-server --appendonly yes *在容器执行redis-server启动命令,并打开redis持久化配置
docker start redis
docker run -dit --name rabbitmq -e RABBITMQ_DEFAULT_USER=guest -e RABBITMQ_DEFAULT_PASS=guest -p 15672:15672 -p 5672:5672 rabbitmq:management
http://192.168.56.10:15672/
查看mq本版,先进入日期内部
1.docker exec -it rabbitmq /bin/bash
2.查询rabbitmqctl 文件路径
find -name rabbitmqctl
3.进入对应的文件
cd /opt/rabbitmq/escript/
查询版本号
rabbitmqctl version
下载地址:https://www.rabbitmq.com/community-plugins.html
我的RabbitMQ 版本是3.9.11,我这里选择下载3.9.0版本的插件
将刚刚上传的插件拷贝到容器内plugins目录下
docker cp /root/rabbitmq_delayed_message_exchange-3.9.0.ez rabbitmq:/plugins
我刚刚是将插件上传到/root
下了; rabbit
是容器的name
,也可以使用容器id
进入到RabbitMQ容器内部
docker exec -it rabbitmq /bin/bash
查看插件是否存在
rabbitmq-plugins list
启动插件
rabbitmq-plugins enable rabbitmq_delayed_message_exchange