Using dockerize to wait for service completed (CI/CD)
2022/1/19 6:03:26
本文主要是介绍Using dockerize to wait for service completed (CI/CD),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
I have a postgresql, and a redis server.
my django application needs to wait for them all completed to run.
BTW, postgresql, redis, django all run in Docker containers . Here 3 containers .
so, use dockerize in my main django Dockerfile
# install dockerize RUN apt-get update && apt-get install -y wget ENV DOCKERIZE_VERSION v0.6.1 RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \ && tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \ && rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
in my docker-compose.yml
web: build: . # wait for postgresql, redis server up using dockerize command: dockerize -wait tcp://redis-cache:6379 -timeout 30s \ dockerize -wait tcp://db:5432 -timeout 30s \ python3 manage.py runserver 0.0.0.0:8000
tcp://redis-cache:6379 // my redis server
tcp://db:5432 // my postgresql database server
after all tcp ports okay, run the commands
python3 manage.py runserver 0.0.0.0:8000
这篇关于Using dockerize to wait for service completed (CI/CD)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-14Docker端口:你真的公开了哪些东西?
- 2024-11-14用DOCKER在家里的实验室里搞些酷炫的玩意儿
- 2024-11-05掌握Docker:高效安全的十大最佳实践
- 2024-11-05在 Docker Compose 中怎么设置端口映射-icode9专业技术文章分享
- 2024-11-05在 Docker Compose 中怎么设置环境变量-icode9专业技术文章分享
- 2024-11-04Docker环境部署项目实战:新手入门教程
- 2024-11-04Docker环境部署资料:新手入门教程
- 2024-11-01Docker环境部署教程:新手入门指南
- 2024-11-01超越Docker:苹果芯片上的模拟、编排和虚拟化方案讲解
- 2024-11-01Docker环境部署:新手入门教程