Reputation: 23
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.```
Upvotes: 2
Views: 2940
Reputation: 159790
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
Upvotes: 2