Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redis in docker starts/restarts multiple times?

I am trying to run redis in docker container by using docker-compose:

docker-compose.yml:

redis:
  image: redis:3.0.4

command:

$ docker-compose up

output:

Starting test_redis_1...
Attaching to test_redis_1
redis_1 | 1:C 06 Oct 15:16:13.265 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis_1 |                 _._                                                  
redis_1 |            _.-``__ ''-._                                             
redis_1 |       _.-``    `.  `_.  ''-._           Redis 3.0.4 (00000000/0) 64 bit
redis_1 |   .-`` .-```.  ```\/    _.,_ ''-._                                   
redis_1 |  (    '      ,       .-`  | `,    )     Running in standalone mode
redis_1 |  |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
redis_1 |  |    `-._   `._    /     _.-'    |     PID: 1
redis_1 |   `-._    `-._  `-./  _.-'    _.-'                                   
redis_1 |  |`-._`-._    `-.__.-'    _.-'_.-'|                                  
redis_1 |  |    `-._`-._        _.-'_.-'    |           http://redis.io        
redis_1 |   `-._    `-._`-.__.-'_.-'    _.-'                                   
redis_1 |  |`-._`-._    `-.__.-'    _.-'_.-'|                                  
redis_1 |  |    `-._`-._        _.-'_.-'    |                                  
redis_1 |   `-._    `-._`-.__.-'_.-'    _.-'                                   
redis_1 |       `-._    `-.__.-'    _.-'                                       
redis_1 |           `-._        _.-'                                           
redis_1 |               `-.__.-'                                               
redis_1 | 
redis_1 | 1:M 06 Oct 15:16:13.268 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
redis_1 | 1:M 06 Oct 15:16:13.268 # Server started, Redis version 3.0.4
redis_1 | 1:M 06 Oct 15:16:13.268 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis_1 | 1:M 06 Oct 15:16:13.268 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
redis_1 | 1:M 06 Oct 15:16:13.268 * DB loaded from disk: 0.000 seconds
redis_1 | 1:M 06 Oct 15:16:13.268 * The server is now ready to accept connections on port 6379
redis_1 | 1:signal-handler (1444144583) Received SIGTERM scheduling shutdown...
redis_1 | 1:M 06 Oct 15:16:23.761 # User requested shutdown...
redis_1 | 1:M 06 Oct 15:16:23.761 * Saving the final RDB snapshot before exiting.
redis_1 | 1:M 06 Oct 15:16:23.770 * DB saved on disk
redis_1 | 1:M 06 Oct 15:16:23.770 # Redis is now ready to exit, bye bye...
redis_1 | 1:C 06 Oct 15:16:32.194 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis_1 |                 _._                                                  
redis_1 |            _.-``__ ''-._                                             
redis_1 |       _.-``    `.  `_.  ''-._           Redis 3.0.4 (00000000/0) 64 bit
redis_1 |   .-`` .-```.  ```\/    _.,_ ''-._                                   
redis_1 |  (    '      ,       .-`  | `,    )     Running in standalone mode
redis_1 |  |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
redis_1 |  |    `-._   `._    /     _.-'    |     PID: 1
redis_1 |   `-._    `-._  `-./  _.-'    _.-'                                   
redis_1 |  |`-._`-._    `-.__.-'    _.-'_.-'|                                  
redis_1 |  |    `-._`-._        _.-'_.-'    |           http://redis.io        
redis_1 |   `-._    `-._`-.__.-'_.-'    _.-'                                   
redis_1 |  |`-._`-._    `-.__.-'    _.-'_.-'|                                  
redis_1 |  |    `-._`-._        _.-'_.-'    |                                  
redis_1 |   `-._    `-._`-.__.-'_.-'    _.-'                                   
redis_1 |       `-._    `-.__.-'    _.-'                                       
redis_1 |           `-._        _.-'                                           
redis_1 |               `-.__.-'                                               
redis_1 | 
redis_1 | 1:M 06 Oct 15:16:32.195 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
redis_1 | 1:M 06 Oct 15:16:32.195 # Server started, Redis version 3.0.4
redis_1 | 1:M 06 Oct 15:16:32.195 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis_1 | 1:M 06 Oct 15:16:32.195 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
redis_1 | 1:M 06 Oct 15:16:32.195 * DB loaded from disk: 0.000 seconds
redis_1 | 1:M 06 Oct 15:16:32.195 * The server is now ready to accept connections on port 6379
redis_1 | 1:signal-handler (1444144597) Received SIGTERM scheduling shutdown...
redis_1 | 1:M 06 Oct 15:16:37.141 # User requested shutdown...
redis_1 | 1:M 06 Oct 15:16:37.141 * Saving the final RDB snapshot before exiting.
redis_1 | 1:M 06 Oct 15:16:37.144 * DB saved on disk
redis_1 | 1:M 06 Oct 15:16:37.144 # Redis is now ready to exit, bye bye...
redis_1 | 1:C 06 Oct 15:17:19.085 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis_1 |                 _._                                                  
redis_1 |            _.-``__ ''-._                                             
redis_1 |       _.-``    `.  `_.  ''-._           Redis 3.0.4 (00000000/0) 64 bit
redis_1 |   .-`` .-```.  ```\/    _.,_ ''-._                                   
redis_1 |  (    '      ,       .-`  | `,    )     Running in standalone mode
redis_1 |  |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
redis_1 |  |    `-._   `._    /     _.-'    |     PID: 1
redis_1 |   `-._    `-._  `-./  _.-'    _.-'                                   
redis_1 |  |`-._`-._    `-.__.-'    _.-'_.-'|                                  
redis_1 |  |    `-._`-._        _.-'_.-'    |           http://redis.io        
redis_1 |   `-._    `-._`-.__.-'_.-'    _.-'                                   
redis_1 |  |`-._`-._    `-.__.-'    _.-'_.-'|                                  
redis_1 |  |    `-._`-._        _.-'_.-'    |                                  
redis_1 |   `-._    `-._`-.__.-'_.-'    _.-'                                   
redis_1 |       `-._    `-.__.-'    _.-'                                       
redis_1 |           `-._        _.-'                                           
redis_1 |               `-.__.-'                                               
redis_1 | 
redis_1 | 1:M 06 Oct 15:17:19.086 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
redis_1 | 1:M 06 Oct 15:17:19.086 # Server started, Redis version 3.0.4
redis_1 | 1:M 06 Oct 15:17:19.086 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis_1 | 1:M 06 Oct 15:17:19.086 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
redis_1 | 1:M 06 Oct 15:17:19.086 * DB loaded from disk: 0.000 seconds
redis_1 | 1:M 06 Oct 15:17:19.086 * The server is now ready to accept connections on port 6379
redis_1 | 1:signal-handler (1444144647) Received SIGTERM scheduling shutdown...
redis_1 | 1:M 06 Oct 15:17:27.247 # User requested shutdown...
redis_1 | 1:M 06 Oct 15:17:27.247 * Saving the final RDB snapshot before exiting.
redis_1 | 1:M 06 Oct 15:17:27.256 * DB saved on disk
redis_1 | 1:M 06 Oct 15:17:27.256 # Redis is now ready to exit, bye bye...

For some reason redis starts multiple times, sometimes just once (this is random). And in logs there are many likes like:

redis_1 | 1:signal-handler (1444144597) Received SIGTERM scheduling shutdown...

env:

docker-compose version: 1.4.0
Docker version 1.8.0, build 0d03096
docker-machine version 0.4.0 (9d0dc7a)

edit: It happens only when using docker-compose. While running redis with docker run redis:304 it works fine.

like image 314
user606521 Avatar asked Oct 23 '25 18:10

user606521


1 Answers

Similar issue has been discussed here: https://github.com/docker/compose/issues/2148

Add --force-recreate to the docker-compose command seems to prevent it.

like image 158
monn Avatar answered Oct 26 '25 08:10

monn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!