docker nginx、rabbitmq、redis部署
发布网友
发布时间:2022-12-03 03:34
我来回答
共1个回答
热心网友
时间:2023-05-11 04:45
1.在服务器下首先安装docker
2.docker nginx部署:
[root@cs007 hs]# docker pull nginx
[root@cs007 hs]# docker run --name nginx-test -p 8081:80 -d nginx
[root@cs007 hs]# docker ps -a -n 1
[root@cs007 hs]# curl localhost:8081
*访问:服务器地址:8081/nginx
docker 部署mysql
docker pull registry.cn-hangzhou.aliyuncs.com/sqqdcl/db:v5
docker run -itd --name mysql-0331 -p 3306:3306 -v /opt/mysql/data:/var/lib/mysql -eMYSQL_ROOT_PASSWORD=sq registry.cn-hangzhou.aliyuncs.com/sqqdcl/db:v5
docker
ps或 docker ps-a或 docker ps-a--no-trunc
docker inspect mysql
1.mkdir -p /opt/mysql/data
docker pull registry.cn-hangzhou.aliyuncs.com/sqqdcl/db:v5
docker run -itd --name mysql-0331 -p 3307:3306 -v /opt/mysql/data:/var/lib/mysql -eMYSQL_ROOT_PASSWORD=sq registry.cn-hangzhou.aliyuncs.com/sqqdcl/db:v5
docker ps或 docker ps-a或 docker ps-a--no-trunc
docker inspect mysql
PS C:\Users\Administrator> docker exec -it e988fbe43744 /bin/bash
root@e988fbe43744:/docker-entrypoint-initdb.d# mysql -psq
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.31 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> exit
2.rabbitmq部署
mkdir -p /opt/rabbitmq/data
docker pull rabbitmq:3.8.3-management
docker run -itd--name rabbitmq0401 -p5672:5672 -p15672:15672 -p15692:15692 -v /opt/rabbitmq/data:/var/lib/rabbitmq -eRABBITMQ_DEFAULT_USER=guest -eRABBITMQ_DEFAULT_PASS=guest rabbitmq:3.8.3-management
3.redis部署
mkdir -p /opt/redis/data
docker pull registry.cn-hangzhou.aliyuncs.com/sqqdcl/redis
docker run -itd --name redis-0401 -p 6380:6379 -v /opt/redis/data:/data -v /etc/localtime:/etc/localtime:ro registry.cn-hangzhou.aliyuncs.com/sqqdcl/redis
docker run -itd --name redis-0401 -p 6380:6379 -v /opt/redis/data:/data registry.cn-hangzhou.aliyuncs.com/sqqdcl/redis