Answer the question
In order to leave comments, you need to log in
I can't establish an AMQP connection between two containers, what could be wrong?
My docker-compose.yml config:
version: "3"
networks:
mydockernet:
driver: bridge
name: mydockernet
services:
# nginx
nginx-service:
image: nginx:stable-alpine
container_name: nginx-container
ports:
- "8080:80"
volumes:
- ./app:/var/www/project
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
depends_on:
- php74-service
- mysql8-service
networks:
- mydockernet
# php
php74-service:
build:
context: .
dockerfile: ./php/Dockerfile
container_name: php74-container
restart: always
ports:
- "9000:9000"
volumes:
- ./app:/var/www/project
networks:
- mydockernet
# mysql
mysql8-service:
image: mysql:8
container_name: mysql8-container
ports:
- "4306:3306"
volumes:
- ./mysql:/var/lib/mysql
command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
restart: always # always restart unless stopped manually
environment:
MYSQL_USER: root
MYSQL_ROOT_PASSWORD: secret
MYSQL_PASSWORD: secret
networks:
- mydockernet
rabbitmq-service:
image: 'bitnami/rabbitmq:latest'
container_name: rabbitmq-container
ports:
- "5671:5672"
- "15671:15672"
volumes:
- 'rabbitmq_data:/data'
networks:
- mydockernet
worker-service:
build:
context: .
dockerfile: ./worker/Dockerfile
container_name: worker-container
restart: unless-stopped
depends_on:
- rabbitmq-service
ports:
- "5000:5000"
volumes:
- ./app:/var/www/project
networks:
- mydockernet
volumes:
rabbitmq_data:
FROM php:7.4-fpm
RUN apt-get update && apt-get install -y zlib1g-dev g++ git libicu-dev zip libzip-dev zip \
&& docker-php-ext-install intl opcache pdo pdo_mysql \
&& pecl install apcu \
&& docker-php-ext-enable apcu \
&& docker-php-ext-configure zip \
&& docker-php-ext-install zip
RUN docker-php-ext-install sockets
RUN apt-get install -y librabbitmq-dev \
&& pecl install amqp \
&& docker-php-ext-enable amqp
RUN apt-get install -y inetutils-ping
WORKDIR /var/www/project
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN curl -sS https://get.symfony.com/cli/installer | bash
RUN mv /root/.symfony/bin/symfony /usr/local/bin/symfony
###> symfony/messenger ###
# Choose one of the transports below
# MESSENGER_TRANSPORT_DSN=doctrine://default
MESSENGER_TRANSPORT_DSN=amqp://user:[email protected]:5671/%2f/messages
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
###< symfony/messenger ###
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question