Reputation: 21
I have been working on a project to dockerize and automate redis deployments when i stumbled upon a very weird issue with my build. This is my current Dockerfile
ARG BUILD_VERSION=5
FROM redis:${BUILD_VERSION}
RUN mkdir /var/log/redis
RUN chown -R redis:redis /data /var/log/redis
EXPOSE 6379
WORKDIR /usr/local/etc/redis
CMD ["/usr/local/bin/redis-server", "/etc/redis.conf"]
This is my compose:
version: '2.2'
services:
redis:
image: test:red5
restart: unless-stopped
ports:
- "6379:6379"
user: $UID:$GID
volumes:
- /var/lib/redis/:/var/lib/redis/
- /var/log/redis/:/var/log/redis/
- /etc/redis.conf:/etc/redis.conf
to be clear i am mounting the redis dirs and configs as volumes because that is whats on the server.. the UID and GID variable gets called in my .env file.
When i docker exec inside the container and run "/usr/local/bin/redis-server", "/etc/redis.conf"
the redis server intializes with no problem. but when i run doocker-compose up i get this exit code.
docker-compose up
Creating network "redis_default" with the default driver
Creating redis_redis_1 ... done
Attaching to redis_redis_1
redis_redis_1 exited with code 0
First question ever on stack overflow :).. Assistance is appreciated
logs(bind address issue was already resolved):
I have no name!@b306768fd72f:/usr/local/src$ tail -f /var/log/redis/redis.log
37:C 19 Jan 2022 18:41:09.928 # Configuration loaded
38:M 19 Jan 2022 18:41:09.931 # Could not create server TCP listening socket *:6379: bind: Address already in use
41:C 19 Jan 2022 18:41:40.389 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
41:C 19 Jan 2022 18:41:40.389 # Redis version=5.0.14, bits=64, commit=00000000, modified=0, pid=41, just started
41:C 19 Jan 2022 18:41:40.389 # Configuration loaded
42:M 19 Jan 2022 18:41:40.393 * Running mode=standalone, port=6379.
42:M 19 Jan 2022 18:41:40.393 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
42:M 19 Jan 2022 18:41:40.393 # Server initialized
42:M 19 Jan 2022 18:41:40.394 * DB loaded from disk: 0.001 seconds
42:M 19 Jan 2022 18:41:40.394 * Ready to accept connections
Upvotes: 0
Views: 1556
Reputation: 21
Found the issue in /etc/redis.conf
..
daemonize yes
this was blocking docker from running redis-server properly since it was trying to create a pidfile.. container is now running once you comment out this line.
Upvotes: 2