I've set up the Laravel server and RabbitMQ in Docker containers using Laravel Sail. When I try to run sail artisan queue:work
I get these errors for these hosts:
- rabbit: php_network_getaddresses: getaddrinfo for rabbit failed: Temporary failure in name resolution
- localhost: Cannot assign requested address
- 192.168.16.2 (IP from
docker inspect rabbitmq
results): Connection refused - 127.0.0.1: Connection refused
I can access the management console on http://127.0.0.1:15672/
and can log in using guest@guest as is set in .env
and config/queue.php
files.
I'm using the vyuldashev/laravel-queue-rabbitmq
package.
Test-NetConnection -ComputerName 127.0.0.1 -Port 5672
produces:
ComputerName : 127.0.0.1
RemoteAddress : 127.0.0.1
RemotePort : 5672
InterfaceAlias : Loopback Pseudo-Interface 1
SourceAddress : 127.0.0.1
TcpTestSucceeded : True
The container was set up with these lines in docker-compose.yml
:
rabbitmq:
container_name: "rabbitmq"
hostname: rabbit
image: rabbitmq:3.8-management
environment:
- RABBITMQ_DEFAULT_USER=guest
- RABBITMQ_DEFAULT_PASS=guest
ports:
- '5672:5672'
- '15672:15672'