1、Dockerfile构建redis镜像
redis_install.sh
#!/bin/bash
yum install -y gcc gcc-c++ make openssl openssl-devel
cd /home/redis-6.2.6
make && make PREFIX=/usr/local/redis install
mkdir -p /usr/local/redis/conf/
cp /home/redis-6.2.6/redis.conf /usr/local/redis/conf/
sed -i '69s/127.0.0.1/0.0.0.0/' /usr/local/redis/conf/redis.conf
sed -i '88s/protected-mode yes/protected-mode no/' /usr/local/redis/conf/redis.conf
编写Dockerfile
FROM centos:7
ADD redis-6.2.6.tar.gz /home
COPY redis_install.sh /home
RUN sh /home/redis_install.sh
ENTRYPOINT /usr/local/redis/bin/redis-server /usr/local/redis/conf/redis.conf
制作redis镜像
docker build -t mycentos:redis .
启动容器
docker run -itd -p 6376:6379 -v /usr/local/software/redis-6.2.6/redis.conf:/usr/local/redis/conf/redis.conf mycentos:redis
2、安装mysql
docker pull mysql:5.7
启动命令
docker run --name some-mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7
进入容器
docker exec -it 429e6a0bd39d env LANG=C.UTF-8 /bin/bash
3、安装nacos
拉取镜像
docker pull nacos/nacos-server
docker run -d -p 8848:8848 --name nacos \
--privileged=true \
--restart=always \
-e JVM_XMS=256m \
-e JVM_XMX=256m \
-e MODE=standalone \
-e PREFER_HOST_MODE=hostname \
nacos/nacos-server
4、安装minio
拉取镜像
docker pull minio/minio
启动容器
docker run --name minio -p 9000:9000 -p 9090:9090 -d --restart=always \
-e "MINIO_ROOT_USER=admin" -e "MINIO_ROOT_PASSWORD=12345678" \
-v /usr/local/software/minio/data:/data -v /usr/local/software/minio/config:/root/.minio minio/minio server /data \
--console-address ":9000" -address ":9090"
5、安装nginx
Dockerfile构建ngxinx
FROM centos:7
ADD nginx-1.19.10.tar.gz /usr/local
COPY nginx_install.sh /usr/local
RUN sh /usr/local/nginx_install.sh
EXPOSE 80
nginx_install.sh
#!/bin/bash
yum install -y gcc gcc-c++ make pcre pcre-devel zlib zlib-devel
cd /usr/local/nginx-1.19.10
./configure --prefix=/usr/local/nginx && make && make install
制作nginx镜像
docker build -t mycentos:nginx .
nginx 运行
docker run -itd -p 80:80 mycentos:nginx /usr/local/nginx/sbin/nginx -g "daemon off;"
开机启动
/etc/rc.d/rc.local