docker官网手册译part 3

本文介绍了Docker中服务的概念,服务是分布式应用的组成部分,用于定义容器在生产环境的行为。通过修改`docker-compose.yml`文件,可以轻松实现应用的扩展和负载均衡。通过创建服务并指定端口映射、副本数量等,可以实现应用的动态伸缩,并通过负载均衡网络进行流量分配。
摘要由CSDN通过智能技术生成

https://docs.docker.com/get-started/part3/#introduction

Introduction

In part 3, we scale our application and enable load-balancing. To do this, we must go one level up in the hierarchy of a distributed application: the service.

part3,我们将拓展应用,支持负载均衡。做到这点,我们必须使用更上级分布式应用层:the service

About services

In a distributed application, different pieces of the app are called “services.” For example, if you imagine a video sharing site, it probably includes a service for storing application data in a database, a service for video transcoding in the background after a user uploads something, a service for the front-end, and so on.

分布式应用程序中,不同的app部分称为services。如,你设想一个视频分享网站,它可能包含数据存储服务,用户上传视频转码服务,前端服务等等。

Services are really just “containers in production.” A service only runs one image, but it codifies the way that image runs—what ports it should use, how many replicas of the container should run so the service has the capacity it needs, and so on. Scaling a service changes the number of container instances running that piece of software, assigning more computing resources to the service in the process.

Services 其实是生产中containers。一个service只运行一个镜像,但定义了镜像的运行方式--端口的使用,服务需要的container副本数,等等。拓展一个服务只是改变运行软件container实例的个数,进程中指定更多的计算资源指向服务。

Luckily it’s very easy to define, run, and scale services with the Docker platform -- just write a docker-compose.yml file.

幸运的是通过Docker平台可以非常简单的定义,运行,拓展服务--只需定义一个docker-compose.yml文件。

Your first docker-compose.yml file

docker-compose.yml file is a YAML file that defines how Docker containers should behave in production.

docker-compose.yml是YAML 文件定义了Docker containers在生产中的行为。

Save this file as docker-compose.yml wherever you want. Be sure you have pushed the image you created in Part 2 to a registry, and update this 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值