title: Redis in docker starts/restarts multiple times?
body: <p>I am trying to run redis in docker container by using <code>docker-compose</code>:</p>
  
  <p>docker-compose.yml:</p>
  
  <pre><code>redis:
    image: redis:3.0.4
  </code></pre>
  
  <p>command:</p>
  
  <pre><code>$ docker-compose up
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>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 &gt; /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 &gt; /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 &gt; /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...
  </code></pre>
  
  <p>For some reason redis starts multiple times, sometimes just once (this is random). And in logs there are many likes like:</p>
  
  <pre><code>redis_1 | 1:signal-handler (1444144597) Received SIGTERM scheduling shutdown...
  </code></pre>
  
  <p>env:</p>
  
  <pre><code>docker-compose version: 1.4.0
  Docker version 1.8.0, build 0d03096
  docker-machine version 0.4.0 (9d0dc7a)
  </code></pre>
  
  <hr>
  
  <p>edit: It happens only when using docker-compose. While running redis with <code>docker run redis:304</code> it works fine.</p>