Connect Redis to Docker-compose












0















I've setup my docker to connect with redis. But upon running the application i'm getting this error




Fatal error: Uncaught CredisException: Connection to Redis redis:0 failed after 2 failures.Last Error : (111) Connection refused in /var/www/html/vendor/colinmollenhour/credis/Client.php:475 Stack trace: #0 /var/www/html/vendor/colinmollenhour/credis/Client.php(471): Credis_Client->connect() #1 /var/www/html/vendor/colinmollenhour/credis/Client.php(784): Credis_Client->connect() #2 /var/www/html/vendor/colinmollenhour/credis/Client.php(637): Credis_Client->__call('select', Array) #3 /var/www/html/vendor/colinmollenhour/cache-backend-redis/Cm/Cache/Backend/Redis.php(382): Credis_Client->select(1) #4 /var/www/html/vendor/colinmollenhour/cache-backend-redis/Cm/Cache/Backend/Redis.php(243): Cm_Cache_Backend_Redis->_applyClientOptions(Object(Credis_Client)) #5 /var/www/html/vendor/magento/zendframework1/library/Zend/Cache.php(153): Cm_Cache_Backend_Redis->__construct(Array) #6 /var/www/html/vendor/magento/zendframework1/library/Zend/Cache.php(94): Zend_Cache::_makeBackend('Cm_Cache_Backen...', Array, true, true) #7 /var/www/ht in /var/www/html/vendor/colinmollenhour/credis/Client.php on line 475




Not sure where to modify. Maybe someone here can help me? This is the configuration I have for my docker-compose.yml



version: '3.0'
services:
web:
image: alexcheng/magento2
ports:
- "8080:80"
- "443:443"
- "32823:22"
links:
- db
env_file:
- env
environment:
- WEB_ALIAS_DOMAIN=local.domain.com
- WEB_DOCUMENT_ROOT=/var/www/html
- PHP_DATE_TIMEZONE=EST
- PHP_DISPLAY_ERRORS=1
- PHP_MEMORY_LIMIT=2048M
- PHP_MAX_EXECUTION_TIME=300
- PHP_POST_MAX_SIZE=500M
- PHP_UPLOAD_MAX_FILESIZE=1024M
volumes:
- "./project:/var/www/html"
container_name: web
links:
- db
- redis
db:
image: mariadb:10
container_name: mariadb
volumes:
- db-data:/var/lib/mysql/data
env_file:
- env
restart: always
ports:
- "3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=my_local_db
phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
- "8580:80"
links:
- db
container_name: phpmyadmin
redis:
image: redis:latest
container_name: redis
restart: always
ports:
- "6379:6379"
volumes:
- redis-data:/data
volumes:
db-data:
external: false
redis-data:
external: false


And this is the content of my env.php file under app/etc/



<?php
return [
'backend' => [
'frontName' => 'admin'
],
'crypt' => [
'key' => 'MY_KEY_HERE'
],
'db' => [
'table_prefix' => '',
'connection' => [
'default' => [
'host' => 'db',
'dbname' => 'my_local_db',
'username' => 'user',
'password' => 'password',
'active' => '1'
]
]
],
'resource' => [
'default_setup' => [
'connection' => 'default'
]
],
'x-frame-options' => 'SAMEORIGIN',
'MAGE_MODE' => 'developer',
'cache' => [
'frontend' => [
'default' => [
'backend' => 'Cm_Cache_Backend_Redis',
'backend_options' => [
'server' => 'redis',
'database' => '0',
'port' => ''
]
],
'page_cache' => [
'backend' => 'Cm_Cache_Backend_Redis',
'backend_options' => [
'server' => 'redis',
'port' => '',
'database' => '1',
'compress_data' => '0'
]
]
]
],
'session' => [
'save' => 'redis',
'redis' => [
'host' => 'redis',
'port' => '',
'password' => '',
'timeout' => '2.5',
'persistent_identifier' => '',
'database' => '2',
'compression_threshold' => '2048',
'compression_library' => 'gzip',
'log_level' => '1',
'max_concurrency' => '6',
'break_after_frontend' => '5',
'break_after_adminhtml' => '30',
'first_lifetime' => '600',
'bot_first_lifetime' => '60',
'bot_lifetime' => '7200',
'disable_locking' => '0',
'min_lifetime' => '60',
'max_lifetime' => '2592000'
]
],
'cache_types' => [
'config' => 1,
'layout' => 1,
'block_html' => 1,
'collections' => 1,
'reflection' => 1,
'db_ddl' => 1,
'compiled_config' => 1,
'eav' => 1,
'customer_notification' => 1,
'config_integration' => 1,
'config_integration_api' => 1,
'full_page' => 1,
'config_webservice' => 1,
'translate' => 1,
'vertex' => 1
],
'install' => [
'date' => 'Wed, 09 Jan 2019 12:54:30 +0000'
]
];


Hope someone can help me with this...









share



























    0















    I've setup my docker to connect with redis. But upon running the application i'm getting this error




    Fatal error: Uncaught CredisException: Connection to Redis redis:0 failed after 2 failures.Last Error : (111) Connection refused in /var/www/html/vendor/colinmollenhour/credis/Client.php:475 Stack trace: #0 /var/www/html/vendor/colinmollenhour/credis/Client.php(471): Credis_Client->connect() #1 /var/www/html/vendor/colinmollenhour/credis/Client.php(784): Credis_Client->connect() #2 /var/www/html/vendor/colinmollenhour/credis/Client.php(637): Credis_Client->__call('select', Array) #3 /var/www/html/vendor/colinmollenhour/cache-backend-redis/Cm/Cache/Backend/Redis.php(382): Credis_Client->select(1) #4 /var/www/html/vendor/colinmollenhour/cache-backend-redis/Cm/Cache/Backend/Redis.php(243): Cm_Cache_Backend_Redis->_applyClientOptions(Object(Credis_Client)) #5 /var/www/html/vendor/magento/zendframework1/library/Zend/Cache.php(153): Cm_Cache_Backend_Redis->__construct(Array) #6 /var/www/html/vendor/magento/zendframework1/library/Zend/Cache.php(94): Zend_Cache::_makeBackend('Cm_Cache_Backen...', Array, true, true) #7 /var/www/ht in /var/www/html/vendor/colinmollenhour/credis/Client.php on line 475




    Not sure where to modify. Maybe someone here can help me? This is the configuration I have for my docker-compose.yml



    version: '3.0'
    services:
    web:
    image: alexcheng/magento2
    ports:
    - "8080:80"
    - "443:443"
    - "32823:22"
    links:
    - db
    env_file:
    - env
    environment:
    - WEB_ALIAS_DOMAIN=local.domain.com
    - WEB_DOCUMENT_ROOT=/var/www/html
    - PHP_DATE_TIMEZONE=EST
    - PHP_DISPLAY_ERRORS=1
    - PHP_MEMORY_LIMIT=2048M
    - PHP_MAX_EXECUTION_TIME=300
    - PHP_POST_MAX_SIZE=500M
    - PHP_UPLOAD_MAX_FILESIZE=1024M
    volumes:
    - "./project:/var/www/html"
    container_name: web
    links:
    - db
    - redis
    db:
    image: mariadb:10
    container_name: mariadb
    volumes:
    - db-data:/var/lib/mysql/data
    env_file:
    - env
    restart: always
    ports:
    - "3306:3306"
    environment:
    - MYSQL_ROOT_PASSWORD=root
    - MYSQL_DATABASE=my_local_db
    phpmyadmin:
    image: phpmyadmin/phpmyadmin
    ports:
    - "8580:80"
    links:
    - db
    container_name: phpmyadmin
    redis:
    image: redis:latest
    container_name: redis
    restart: always
    ports:
    - "6379:6379"
    volumes:
    - redis-data:/data
    volumes:
    db-data:
    external: false
    redis-data:
    external: false


    And this is the content of my env.php file under app/etc/



    <?php
    return [
    'backend' => [
    'frontName' => 'admin'
    ],
    'crypt' => [
    'key' => 'MY_KEY_HERE'
    ],
    'db' => [
    'table_prefix' => '',
    'connection' => [
    'default' => [
    'host' => 'db',
    'dbname' => 'my_local_db',
    'username' => 'user',
    'password' => 'password',
    'active' => '1'
    ]
    ]
    ],
    'resource' => [
    'default_setup' => [
    'connection' => 'default'
    ]
    ],
    'x-frame-options' => 'SAMEORIGIN',
    'MAGE_MODE' => 'developer',
    'cache' => [
    'frontend' => [
    'default' => [
    'backend' => 'Cm_Cache_Backend_Redis',
    'backend_options' => [
    'server' => 'redis',
    'database' => '0',
    'port' => ''
    ]
    ],
    'page_cache' => [
    'backend' => 'Cm_Cache_Backend_Redis',
    'backend_options' => [
    'server' => 'redis',
    'port' => '',
    'database' => '1',
    'compress_data' => '0'
    ]
    ]
    ]
    ],
    'session' => [
    'save' => 'redis',
    'redis' => [
    'host' => 'redis',
    'port' => '',
    'password' => '',
    'timeout' => '2.5',
    'persistent_identifier' => '',
    'database' => '2',
    'compression_threshold' => '2048',
    'compression_library' => 'gzip',
    'log_level' => '1',
    'max_concurrency' => '6',
    'break_after_frontend' => '5',
    'break_after_adminhtml' => '30',
    'first_lifetime' => '600',
    'bot_first_lifetime' => '60',
    'bot_lifetime' => '7200',
    'disable_locking' => '0',
    'min_lifetime' => '60',
    'max_lifetime' => '2592000'
    ]
    ],
    'cache_types' => [
    'config' => 1,
    'layout' => 1,
    'block_html' => 1,
    'collections' => 1,
    'reflection' => 1,
    'db_ddl' => 1,
    'compiled_config' => 1,
    'eav' => 1,
    'customer_notification' => 1,
    'config_integration' => 1,
    'config_integration_api' => 1,
    'full_page' => 1,
    'config_webservice' => 1,
    'translate' => 1,
    'vertex' => 1
    ],
    'install' => [
    'date' => 'Wed, 09 Jan 2019 12:54:30 +0000'
    ]
    ];


    Hope someone can help me with this...









    share

























      0












      0








      0








      I've setup my docker to connect with redis. But upon running the application i'm getting this error




      Fatal error: Uncaught CredisException: Connection to Redis redis:0 failed after 2 failures.Last Error : (111) Connection refused in /var/www/html/vendor/colinmollenhour/credis/Client.php:475 Stack trace: #0 /var/www/html/vendor/colinmollenhour/credis/Client.php(471): Credis_Client->connect() #1 /var/www/html/vendor/colinmollenhour/credis/Client.php(784): Credis_Client->connect() #2 /var/www/html/vendor/colinmollenhour/credis/Client.php(637): Credis_Client->__call('select', Array) #3 /var/www/html/vendor/colinmollenhour/cache-backend-redis/Cm/Cache/Backend/Redis.php(382): Credis_Client->select(1) #4 /var/www/html/vendor/colinmollenhour/cache-backend-redis/Cm/Cache/Backend/Redis.php(243): Cm_Cache_Backend_Redis->_applyClientOptions(Object(Credis_Client)) #5 /var/www/html/vendor/magento/zendframework1/library/Zend/Cache.php(153): Cm_Cache_Backend_Redis->__construct(Array) #6 /var/www/html/vendor/magento/zendframework1/library/Zend/Cache.php(94): Zend_Cache::_makeBackend('Cm_Cache_Backen...', Array, true, true) #7 /var/www/ht in /var/www/html/vendor/colinmollenhour/credis/Client.php on line 475




      Not sure where to modify. Maybe someone here can help me? This is the configuration I have for my docker-compose.yml



      version: '3.0'
      services:
      web:
      image: alexcheng/magento2
      ports:
      - "8080:80"
      - "443:443"
      - "32823:22"
      links:
      - db
      env_file:
      - env
      environment:
      - WEB_ALIAS_DOMAIN=local.domain.com
      - WEB_DOCUMENT_ROOT=/var/www/html
      - PHP_DATE_TIMEZONE=EST
      - PHP_DISPLAY_ERRORS=1
      - PHP_MEMORY_LIMIT=2048M
      - PHP_MAX_EXECUTION_TIME=300
      - PHP_POST_MAX_SIZE=500M
      - PHP_UPLOAD_MAX_FILESIZE=1024M
      volumes:
      - "./project:/var/www/html"
      container_name: web
      links:
      - db
      - redis
      db:
      image: mariadb:10
      container_name: mariadb
      volumes:
      - db-data:/var/lib/mysql/data
      env_file:
      - env
      restart: always
      ports:
      - "3306:3306"
      environment:
      - MYSQL_ROOT_PASSWORD=root
      - MYSQL_DATABASE=my_local_db
      phpmyadmin:
      image: phpmyadmin/phpmyadmin
      ports:
      - "8580:80"
      links:
      - db
      container_name: phpmyadmin
      redis:
      image: redis:latest
      container_name: redis
      restart: always
      ports:
      - "6379:6379"
      volumes:
      - redis-data:/data
      volumes:
      db-data:
      external: false
      redis-data:
      external: false


      And this is the content of my env.php file under app/etc/



      <?php
      return [
      'backend' => [
      'frontName' => 'admin'
      ],
      'crypt' => [
      'key' => 'MY_KEY_HERE'
      ],
      'db' => [
      'table_prefix' => '',
      'connection' => [
      'default' => [
      'host' => 'db',
      'dbname' => 'my_local_db',
      'username' => 'user',
      'password' => 'password',
      'active' => '1'
      ]
      ]
      ],
      'resource' => [
      'default_setup' => [
      'connection' => 'default'
      ]
      ],
      'x-frame-options' => 'SAMEORIGIN',
      'MAGE_MODE' => 'developer',
      'cache' => [
      'frontend' => [
      'default' => [
      'backend' => 'Cm_Cache_Backend_Redis',
      'backend_options' => [
      'server' => 'redis',
      'database' => '0',
      'port' => ''
      ]
      ],
      'page_cache' => [
      'backend' => 'Cm_Cache_Backend_Redis',
      'backend_options' => [
      'server' => 'redis',
      'port' => '',
      'database' => '1',
      'compress_data' => '0'
      ]
      ]
      ]
      ],
      'session' => [
      'save' => 'redis',
      'redis' => [
      'host' => 'redis',
      'port' => '',
      'password' => '',
      'timeout' => '2.5',
      'persistent_identifier' => '',
      'database' => '2',
      'compression_threshold' => '2048',
      'compression_library' => 'gzip',
      'log_level' => '1',
      'max_concurrency' => '6',
      'break_after_frontend' => '5',
      'break_after_adminhtml' => '30',
      'first_lifetime' => '600',
      'bot_first_lifetime' => '60',
      'bot_lifetime' => '7200',
      'disable_locking' => '0',
      'min_lifetime' => '60',
      'max_lifetime' => '2592000'
      ]
      ],
      'cache_types' => [
      'config' => 1,
      'layout' => 1,
      'block_html' => 1,
      'collections' => 1,
      'reflection' => 1,
      'db_ddl' => 1,
      'compiled_config' => 1,
      'eav' => 1,
      'customer_notification' => 1,
      'config_integration' => 1,
      'config_integration_api' => 1,
      'full_page' => 1,
      'config_webservice' => 1,
      'translate' => 1,
      'vertex' => 1
      ],
      'install' => [
      'date' => 'Wed, 09 Jan 2019 12:54:30 +0000'
      ]
      ];


      Hope someone can help me with this...









      share














      I've setup my docker to connect with redis. But upon running the application i'm getting this error




      Fatal error: Uncaught CredisException: Connection to Redis redis:0 failed after 2 failures.Last Error : (111) Connection refused in /var/www/html/vendor/colinmollenhour/credis/Client.php:475 Stack trace: #0 /var/www/html/vendor/colinmollenhour/credis/Client.php(471): Credis_Client->connect() #1 /var/www/html/vendor/colinmollenhour/credis/Client.php(784): Credis_Client->connect() #2 /var/www/html/vendor/colinmollenhour/credis/Client.php(637): Credis_Client->__call('select', Array) #3 /var/www/html/vendor/colinmollenhour/cache-backend-redis/Cm/Cache/Backend/Redis.php(382): Credis_Client->select(1) #4 /var/www/html/vendor/colinmollenhour/cache-backend-redis/Cm/Cache/Backend/Redis.php(243): Cm_Cache_Backend_Redis->_applyClientOptions(Object(Credis_Client)) #5 /var/www/html/vendor/magento/zendframework1/library/Zend/Cache.php(153): Cm_Cache_Backend_Redis->__construct(Array) #6 /var/www/html/vendor/magento/zendframework1/library/Zend/Cache.php(94): Zend_Cache::_makeBackend('Cm_Cache_Backen...', Array, true, true) #7 /var/www/ht in /var/www/html/vendor/colinmollenhour/credis/Client.php on line 475




      Not sure where to modify. Maybe someone here can help me? This is the configuration I have for my docker-compose.yml



      version: '3.0'
      services:
      web:
      image: alexcheng/magento2
      ports:
      - "8080:80"
      - "443:443"
      - "32823:22"
      links:
      - db
      env_file:
      - env
      environment:
      - WEB_ALIAS_DOMAIN=local.domain.com
      - WEB_DOCUMENT_ROOT=/var/www/html
      - PHP_DATE_TIMEZONE=EST
      - PHP_DISPLAY_ERRORS=1
      - PHP_MEMORY_LIMIT=2048M
      - PHP_MAX_EXECUTION_TIME=300
      - PHP_POST_MAX_SIZE=500M
      - PHP_UPLOAD_MAX_FILESIZE=1024M
      volumes:
      - "./project:/var/www/html"
      container_name: web
      links:
      - db
      - redis
      db:
      image: mariadb:10
      container_name: mariadb
      volumes:
      - db-data:/var/lib/mysql/data
      env_file:
      - env
      restart: always
      ports:
      - "3306:3306"
      environment:
      - MYSQL_ROOT_PASSWORD=root
      - MYSQL_DATABASE=my_local_db
      phpmyadmin:
      image: phpmyadmin/phpmyadmin
      ports:
      - "8580:80"
      links:
      - db
      container_name: phpmyadmin
      redis:
      image: redis:latest
      container_name: redis
      restart: always
      ports:
      - "6379:6379"
      volumes:
      - redis-data:/data
      volumes:
      db-data:
      external: false
      redis-data:
      external: false


      And this is the content of my env.php file under app/etc/



      <?php
      return [
      'backend' => [
      'frontName' => 'admin'
      ],
      'crypt' => [
      'key' => 'MY_KEY_HERE'
      ],
      'db' => [
      'table_prefix' => '',
      'connection' => [
      'default' => [
      'host' => 'db',
      'dbname' => 'my_local_db',
      'username' => 'user',
      'password' => 'password',
      'active' => '1'
      ]
      ]
      ],
      'resource' => [
      'default_setup' => [
      'connection' => 'default'
      ]
      ],
      'x-frame-options' => 'SAMEORIGIN',
      'MAGE_MODE' => 'developer',
      'cache' => [
      'frontend' => [
      'default' => [
      'backend' => 'Cm_Cache_Backend_Redis',
      'backend_options' => [
      'server' => 'redis',
      'database' => '0',
      'port' => ''
      ]
      ],
      'page_cache' => [
      'backend' => 'Cm_Cache_Backend_Redis',
      'backend_options' => [
      'server' => 'redis',
      'port' => '',
      'database' => '1',
      'compress_data' => '0'
      ]
      ]
      ]
      ],
      'session' => [
      'save' => 'redis',
      'redis' => [
      'host' => 'redis',
      'port' => '',
      'password' => '',
      'timeout' => '2.5',
      'persistent_identifier' => '',
      'database' => '2',
      'compression_threshold' => '2048',
      'compression_library' => 'gzip',
      'log_level' => '1',
      'max_concurrency' => '6',
      'break_after_frontend' => '5',
      'break_after_adminhtml' => '30',
      'first_lifetime' => '600',
      'bot_first_lifetime' => '60',
      'bot_lifetime' => '7200',
      'disable_locking' => '0',
      'min_lifetime' => '60',
      'max_lifetime' => '2592000'
      ]
      ],
      'cache_types' => [
      'config' => 1,
      'layout' => 1,
      'block_html' => 1,
      'collections' => 1,
      'reflection' => 1,
      'db_ddl' => 1,
      'compiled_config' => 1,
      'eav' => 1,
      'customer_notification' => 1,
      'config_integration' => 1,
      'config_integration_api' => 1,
      'full_page' => 1,
      'config_webservice' => 1,
      'translate' => 1,
      'vertex' => 1
      ],
      'install' => [
      'date' => 'Wed, 09 Jan 2019 12:54:30 +0000'
      ]
      ];


      Hope someone can help me with this...







      magento2 magento-2.1 magento2.3 redis docker





      share












      share










      share



      share










      asked 6 mins ago









      MadzQuestioningMadzQuestioning

      1678




      1678






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "479"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f266197%2fconnect-redis-to-docker-compose%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f266197%2fconnect-redis-to-docker-compose%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          What other Star Trek series did the main TNG cast show up in?

          Berlina muro

          Berlina aerponto