text docker deploy scale swarm模式
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text docker deploy scale swarm模式相关的知识,希望对你有一定的参考价值。
============================= app.py ==========
from flask import Flask
from redis import Redis
app = Flask(__name__)
redis = Redis(host='redis', port=6379)
@app.route('/')
def hello():
count = redis.incr('hits')
return 'Hello World! I have been seen {} times.\n'.format(count)
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8000, debug=True)
============================= dockerfile ==========
FROM python:3.4-alpine
ADD . /code
WORKDIR /code
RUN pip install -r requirements.txt
CMD ["python", "app.py"]
============================= docker-compose ==========
version: '3'
services:
webScale:
image: 127.0.0.1:5000/dockerscale1
build: .
ports:
- "8000:8000"
redis:
image: redis:alpine
ports:
- "6379:6379"
redis-commander:
container_name: redis-commander
hostname: redis-commander
image: rediscommander/redis-commander:latest
restart: always
environment:
- REDIS_HOSTS=local:redis:6379
ports:
- "8081:8081"
============================= docker-command ==========
docker stack deploy --compose-file docker-compose.yml dockerscale1
docker stack services dockerscale1
curl http://localhost:8000
docker stack rm dockerscale1
以上是关于text docker deploy scale swarm模式的主要内容,如果未能解决你的问题,请参考以下文章
text docker-compose scale 2,3,4,5
当我们执行“kubectl scale deploy”时,Kubernetes 不尊重 HPA 配置吗?
将 Auto Scaling 与 Code Deploy 结合使用 - Ec2 实例无限循环重启
通过一个实际例子理解Kubernetes里pod的自动scale - 水平自动伸缩
用于小规模部署的简单Headscale web UI。
Deploying Docker images via SSH