我想在minikube中为我的Redis容器启用密码。因此,我在redis.conf中启用了requirepass。然后,我使用以下Dockerfile使用此配置文件生成Docker镜像。
FROM redis
COPY --chown=redis:redis redis.conf /usr/local/etc/redis/redis.conf
CMD ["redis-server", "/usr/local/etc/redis/redis.conf"]然后,我使用以下Deployment YAML启动包含此图像的pod。
kind: Deployment
apiVersion: apps/v1
metadata:
name: cache
labels:
run: cache
spec:
replicas: 1
selector:
matchLabels:
run: cache
template:
metadata:
labels:
run: cache
spec:
containers:
- name: cache
image: redis
envFrom:
- configMapRef:
name: redis-cfgmap
resources:
limits:
memory: "256Mi"
cpu: "200m"
imagePullPolicy: Never
restartPolicy: Always
terminationGracePeriodSeconds: 30请注意,我正在从运行eval $(minikube docker-env)的shell执行docker build -t redis:latest。此外,将imagePullPolicy设置为Never,以便从本地Dokcer注册表中拉出图像。
虽然pod确实出现了,但日志中提到,并未使用指定的配置文件。
6:C 27 Feb 2020 04:06:08.568 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
6:C 27 Feb 2020 04:06:08.568 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=6, just started
6:C 27 Feb 2020 04:06:08.568 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
6:M 27 Feb 2020 04:06:08.570 * Running mode=standalone, port=6379.
6:M 27 Feb 2020 04:06:08.570 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
6:M 27 Feb 2020 04:06:08.570 # Server initialized
6:M 27 Feb 2020 04:06:08.571 * Ready to accept connections遗漏了什么?
发布于 2020-02-28 22:31:58
只是为想要阅读它的人提供更多的解释。
由于某种原因,你正在构建的镜像-而不是它应该覆盖现有的镜像-没有做到这一点,你被redis:latest官方镜像卡住了,而不是你刚刚构建的那个。
当处理这个问题并尝试构建镜像时,我遇到了与您相同的问题,并设法运行docker system prune解决了它,但在那之后,我没有设法再次复制它,所以我很难说出它的真正原因是什么。
无论如何,我很高兴它为你工作。
https://stackoverflow.com/questions/60423739
复制相似问题