英文:
REDIS not able to connect inside Ubuntu Docker Container
问题
我有Mac,并在上面安装了Docker。
我已经从最新的Ubuntu镜像创建了一个容器。
这是我的Docker命令:
docker run -it --name ubuntu-container -p 6379:6379 ubuntu /bin/bash
现在在Ubuntu容器内部,我正在尝试这样做:
apt-get update
apt-get install -y redis-tools
然而,尽管在Ubuntu容器内成功安装了Redis,但我无法运行Redis。
root@14d6783b73b3:/# redis-cli ping
无法连接到Redis 127.0.0.1:6379:连接被拒绝
由于我对Docker和Redis都不熟悉,我无法理解根本原因。
英文:
I have mac and installed docker on it.
I have created a container from latest ubuntu image.
This is my docker command:
docker run -it --name ubuntu-container -p 6379:6379 ubuntu /bin/bash
Now inside ubuntu container I am trying this
apt-get update
apt-get install -y redis-tools
However, I am not able to run redis after successfully installing it inside Ubuntu Container.
root@14d6783b73b3:/# redis-cli ping
Could not connect to Redis at 127.0.0.1:6379: Connection refused
Since, I am new to docker and Redis, I am not able to understand the root cause itself.
答案1
得分: 0
我错过了完全安装 redis。
这是命令
RUN apt-get install redis
由于未安装 redis-server,它显示无法连接到 127.0.0.1:6379 的 Redis。
英文:
I missed to install redis completely.
This is the command
RUN apt-get install redis
Since redis-server was not installed, it was saying that Could not connect to Redis at 127.0.0.1:6379.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论