PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, March 7, 2022

[FIXED] ERROR: for csi_redis Cannot start service redis: Ports are not available: listen tcp 127.0.0.1:6379: bind: address already in use

 March 07, 2022     composer-php, docker, homebrew, laravel, redis     No comments   

Issue

I'm trying to install a project that runs: PHP, Laravel Framework, Postgres DB, NPM/NODE

I've installed postgresql and redis with brew. When I get to docker-compose up -d I'm getting this error below: (nothing else is running..I'm able to get this to work on another computer but this one doesn't want to play nice, everything similar I've looked up here hasn't worked yet.)

Starting csi_redis ... error

ERROR: for csi_redis  Cannot start service redis: Ports are not available: listen tcp 127.0.0.1:6379: bind: address already in use

ERROR: for redis  Cannot start service redis: Ports are not available: listen tcp 127.0.0.1:6379: bind: address already in use
ERROR: Encountered errors while bringing up the project.```

Solution

When you install Redis with Homebrew, it listens on port 6379 on the host. If your docker-compose.yml file has a section like

version: '3'
services:
  redis:
    image: redis
    ports:
      - '127.0.0.1:6379:6379'

that also tries to listen to port 6379 on the host, which produces the error you're seeing.

You probably don't need two Redises for your project, so possibly the simplest answer is to brew uninstall redis, or at least brew services stop redis. You can interact with the containerized Redis the same way as you would have the Brew Redis.

If you need the host Redis for local development but the Docker Redis to run your project, you can pick a different port (or, potentially, delete the ports: entirely)

ports:
  - '6380:6379' # keep the second port number the same


Answered By - David Maze
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing