简体   繁体   中英

How to run RabbitMQ and Celery Service in Docker?

I am having issues while running my Python Flask application from Docker pull (remote pull). In my app I had used RabbitMQ as message broker, and Celery as task scheduler. It is working as expected when running locally, But when I put my application on Docker, and Docker pull it from remote system, it runs fine, but Celery and RabbitMQ are not running with it, so all tasks (with method.delay()) are running infinitely and http request is not being processed.

I need help in putting my Python Flask application to Docker, as my application has asynchronous tasks to be processed with Celery. I am not aware about how to modify docker-compose.yml for including Celery service.

Thanks is advance.

I think you need to link celery container with rabbitmq.
From https://docs.docker.com/compose/compose-file/#links

Link to containers in another service. Either specify both the service name and a link alias (SERVICE:ALIAS), or just the service name.

links:
  - rabbitmq

Or

  - rabbitmq:rabbitmq

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM