Docker App应用

Docker App是Docker的一个实验特性,提供了一种类似管理Docker镜像和容器的方式来管理整个应用程序。这个特性包括了应用元数据、服务定义和默认参数。Docker App通过一个单一的配置文件简化了应用程序的构建、验证和部署,并且支持安全的供应链功能。本指南介绍了如何初始化、部署和管理Docker App项目,包括从头开始创建新项目、将现有Compose应用转换为Docker App(尚处于Beta阶段),以及如何在Docker Swarm上部署和管理这些应用。
摘要由CSDN通过智能技术生成

Docker App应用

这是一个实验特性。

实验性功能提供了对未来产品功能的早期访问。这些特性仅用于测试和反馈,因为它们可能在没有警告的情况下在不同版本之间更改,或者可以从将来的版本中完全删除。在生产环境中不得使用实验性功能。

Docker不支持实验特性。

要在Docker CLI中启用实验性功能,请编辑config.json文件并将“实验”设置为“已启用”。

要从Docker桌面菜单启用实验功能,请单击设置(macOS上的首选项)>命令行,然后启用启用启用实验功能切换。单击应用并重新启动。

有关Docker CLI中当前实验功能的列表,请参阅Docker CLI实验功能。

Overview

Docker App是一个CLI插件,它引入了一个顶级的Docker App命令,为应用程序带来容器体验。下表比较了Docker容器和Docker应用程序。

有了Docker应用程序,整个应用程序现在可以像管理图像和容器一样轻松。例如,Docker App允许使用Docker App命令构建、验证和部署应用程序。甚至可以利用安全的供应链功能,例如签名的推拉操作。

注:docker应用程序可与docker 19.03或更高版本配合使用。

本指南将引导了解两种情况:

从头开始初始化并部署新的Docker应用程序项目。

将现有的Compose应用程序转换为Docker应用程序项目(稍后在beta过程中添加)。

第一个场景描述Docker应用程序的基本组件以及工具和工作流。

从头开始初始化并部署新的Docker应用程序项目

本节介绍创建新Docker应用程序项目的步骤,熟悉工作流和最重要的命令。

l Prerequisites

l Initialize an empty new project

l Populate the project

l Validate the app

l Deploy the app

l Push the app to Docker Hub

l Install the app directly from Docker Hub

先决条件

你需要至少一个Docker节点在Swarm模式下运行。还需要包含appcli插件的Docker CLI的最新版本。

根据Linux发行版和安全上下文,可能需要在命令前面添加sudo。

初始化新的空项目

docker app init命令用于初始化新的docker应用程序项目。如果运行它,它会初始化一个新的空项目。如果把它指向一个现有的docker-compose.yml文件,它将基于合成文件初始化新项目。

使用以下命令初始化名为“hello world”的新空项目。

$ docker
app init --single-file hello-world

Created “hello-world.dockerapp”

该命令在当前目录中生成一个名为hello的hello-world.dockerapp。文件名的格式附加了“.dockerapp”。

$ ls

hello-world.dockerapp

If you run docker
app init without the --single-file flag, you get a new directory containing three YAML files. The name of
the directory is the name of the project with .dockerapp appended, and the three YAML files are:

docker-compose.yml
metadata.yml
parameters.yml

However, the --single-file option merges the three YAML files into a single YAML file with three
sections. Each of these sections relates to one of the three YAML files mentioned
previously: docker-compose.yml, metadata.yml, and parameters.yml. Using the --single-file option enables
you to share your application using a single configuration file.

Inspect the YAML
with the following command.

$ cat hello-world.dockerapp

Application metadata - equivalent to metadata.yml.

version: 0.1.0

name: hello-world

description:


Application services - equivalent to docker-compose.yml.

version: “3.6”

services: {}


<

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值