1 mysql
docker pull mysql:8.0.26
docker run -d --name mysql8 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -v ~/DockerDir/mysql/:/etc/mysql/conf.d mysql:8.0.26
# mysql下的是MySQL客户端的配置
[mysql]
# mysqld下的是MySQL服务端的配置
[mysqld]
user = mysql
port = 3306
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
# 允许连接的IP地址, 注释掉之后所有IP的机器都可以连接本MySQL服务端
# bind-address = 127.0.0.1
# 指定单个查询能够使用的缓冲区大小
key_buffer_size = 16M
2 redis
docker pull redis
docker run -d --name redis1 -p 6379:6379 -v ~/DockerDir/redis:/etc/redis redis redis-server /etc/redis/redis.conf
# 接收来自0.0.0.0网卡的请求
bind 0.0.0.0
# 不启用保护模式, 外界可访问
protected-mode no
# redis-server绑定的端口号
port 6379
# 设置认证密码
requirepass redis123!
# redis-server后台运行
daemonize no
# 工作目录
dir ./
# RDB配置
save 900 1
save 300 10
save 60 10000
dbfilename dump.rdb
# AOF配置
appendonly yes
appendfilename "appendonly.aof"
3 mongo
docker pull mongo:4.4.13
docker run -d --name mongo -p 27017:27017 -e MONGO_INITDB_ROOT_USERNAME=admin -e MONGO_INITDB_ROOT_PASSWORD=mongo123 mongo:4.4.13
4 kafka
docker pull wurstmeister/zookeeper
docker pull wurstmeister/kafka
docker run -d --name zookeeper -p 2181:2181 -t wurstmeister/zookeeper
docker run --name kafka1 \
-p 9092:9092 \
-e KAFKA_BROKER_ID=0 \
-e KAFKA_ZOOKEEPER_CONNECT=内网IP:2181 \
-e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://公网IP:9092 \
-e KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092 \
-d wurstmeister/kafka
docker run --name kafka2 \
-p 9093:9093 \
-e KAFKA_BROKER_ID=1 \
-e KAFKA_ZOOKEEPER_CONNECT=内网IP:2181 \
-e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://公网IP:9093 \
-e KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9093 \
-d wurstmeister/kafka
5 nginx
server {
listen 80;
server_name localhost;
location /static/ {
alias /home/;
}
}
docker pull nginx
docker run -d --name nginx1 -p 80:80 \
-v /home/nginx_conf:/etc/nginx/conf.d \
-v /home:/home \
nginx
0 附:解决docker镜像pull慢
vi /etc/docker/daemon.json
{
"registry-mirrors" : ["https://docker.mirrors.ustc.edu.cn"]
}
service docker restart