docker安装部署redis用docker-compose启动设置密码
2021/11/25 19:09:46
本文主要是介绍docker安装部署redis用docker-compose启动设置密码,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
搜索镜像
[root@localhost ~]# docker search redis
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
redis Redis is an open source key-value store that… 10202 [OK]
sameersbn/redis 83 [OK]
grokzen/redis-cluster Redis cluster 3.0, 3.2, 4.0, 5.0, 6.0, 6.2 80
rediscommander/redis-commander Alpine image for redis-commander - Redis man… 70 [OK]
redislabs/redisearch Redis With the RedisSearch module pre-loaded… 41
redislabs/redisinsight RedisInsight - The GUI for Redis 35
kubeguide/redis-master redis-master with "Hello World!" 33
oliver006/redis_exporter Prometheus Exporter for Redis Metrics. Supp… 31
redislabs/redis Clustered in-memory database engine compatib… 31
redislabs/rejson RedisJSON - Enhanced JSON data type processi… 31
arm32v7/redis Redis is an open source key-value store that… 25
arm64v8/redis Redis is an open source key-value store that… 19
redislabs/redisgraph A graph database module for Redis 17 [OK]
redislabs/rebloom A probablistic datatypes module for Redis 16 [OK]
redislabs/redismod An automated build of redismod - latest Redi… 15 [OK]
webhippie/redis Docker image for redis 11 [OK]
s7anley/redis-sentinel-docker Redis Sentinel 10 [OK]
insready/redis-stat Docker image for the real-time Redis monitor… 10 [OK]
redislabs/redistimeseries A time series database module for Redis 10
goodsmileduck/redis-cli redis-cli on alpine 9 [OK]
centos/redis-32-centos7 Redis in-memory data structure store, used a… 6
clearlinux/redis Redis key-value data structure server with t… 3
tiredofit/redis Redis Server w/ Zabbix monitoring and S6 Ove… 1 [OK]
wodby/redis Redis container image with orchestration 1 [OK]
xetamus/redis-resource forked redis-resource 0 [OK]
拉取镜像
[root@localhost ~]# docker pull redis
Using default tag: latest
latest: Pulling from library/redis
eff15d958d66: Pull complete
1aca8391092b: Pull complete
06e460b3ba1b: Pull complete
def49df025c0: Pull complete
646c72a19e83: Pull complete
db2c789841df: Pull complete
Digest: sha256:619af14d3a95c30759a1978da1b2ce375504f1af70ff9eea2a8e35febc45d747
Status: Downloaded newer image for redis:latest
docker.io/library/redis:latest
设置docker-compose.yml配置
[root@localhost bin]# vi docker-compose.yml
version: '3'
services:
redis:
image: redis:latest
restart: always
container_name: redis
command:
- /bin/bash
- -c
- redis-server /usr/local/bin/redis.conf/redis.conf --requirepass "xxxxxxxx"
privileged: true
ports:
- "0.0.0.0:6379:6379"
volumes:
- ./redis/data:/data
- ./redis/redis.conf:/usr/local/bin/redis.conf/redis.conf
创建Redis容器
[root@localhost bin]# docker-compose up -d
Creating redis ... done
[root@localhost bin]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e558e25c45bb redis:latest "docker-entrypoint.s…" 13 minutes ago Up 13 minutes 0.0.0.0:6379->6379/tcp redis
本机客户端登录
root@e558e25c45bb:/usr/local/bin#
root@e558e25c45bb:/usr/local/bin# ./redis-cli -h 127.0.0.1 -p 6379 -a "xxxxxx"
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
127.0.0.1:6379> ping
PONG
127.0.0.1:6379>
这篇关于docker安装部署redis用docker-compose启动设置密码的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-08阿里云Redis项目实战入门教程
- 2024-11-08阿里云Redis资料:新手入门与初级使用指南
- 2024-11-08阿里云Redis教程:新手入门及实用指南
- 2024-11-07阿里云Redis学习入门:新手必读指南
- 2024-11-07阿里云Redis学习入门:从零开始的操作指南
- 2024-11-07阿里云Redis学习:初学者指南
- 2024-11-06阿里云Redis入门教程:轻松搭建与使用指南
- 2024-11-02Redis项目实战:新手入门教程
- 2024-10-22Redis入门教程:轻松掌握数据存储与操作
- 2024-10-22Redis缓存入门教程:快速掌握Redis缓存基础知识