跳转到主要内容

Microsoft Azure命令行工具容器命令模块

项目描述

Microsoft Azure CLI 'container' 命令模块

管理Azure容器实例的命令

Group
    az container: Manage Azure Container Instances.

Commands:
    attach: Attach local standard output and error streams to a container in a container group.
    create: Create a container group.
    delete: Delete a container group.
    list  : List container groups.
    logs  : Tail the log of a container group.
    show  : Show the details of a container group.

创建Azure容器组的命令

Command
    az container create: Create a container group.

Arguments
    --image             [Required]: The container image name.
    --name -n           [Required]: The name of the container group.
    --resource-group -g [Required]: Name of resource group. You can configure the default group
                                    using `az configure --defaults group=<name>`.
    --command-line                : The command line to run when the container is started, e.g.
                                    '/bin/bash -c myscript.sh'.
    --cpu                            : The required number of CPU cores of the containers.  Default:
                                    1.
    --dns-name-label                 : The dns name label for container group with public IP.
    --environment-variables -e       : A list of environment variable for the container. Space-
                                    separated values in 'key=value' format.
    --file -f                        : The path to the input file.
    --image                          : The container image name.
    --ip-address                     : The IP address type of the container group.  Allowed values:
                                    Public.
    --location -l                    : Location. You can configure the default location using `az
                                    configure --defaults location=<location>`.
    --memory                         : The required memory of the containers in GB.  Default: 1.5.
    --name -n                        : The name of the container group.
    --no-wait                        : Do not wait for the long-running operation to finish.
    --os-type                        : The OS type of the containers.  Allowed values: Linux,
                                    Windows.  Default: Linux.
    --ports                          : The ports to open.  Default: [80].
    --protocol                       : The network protocol to use.  Allowed values: TCP, UDP.
    --restart-policy                 : Restart policy for all containers within the container group.
                                    Allowed values: Always, Never, OnFailure.  Default: Always.
    --secrets                        : Space-separated secrets in 'key=value' format.
    --secrets-mount-path             : The path within the container where the secrets volume should
                                    be mounted. Must not contain colon ':'.
    --secure-environment-variables   : A list of secure environment variable for the container.
                                    Space-separated values in 'key=value' format.

Image Registry Arguments
    --registry-login-server       : The container image registry login server.
    --registry-password           : The password to log in container image registry server.
    --registry-username           : The username to log in container image registry server.

Log Analytics Arguments
    --log-analytics-workspace       : The Log Analytics workspace name or id. Use the --subscription
                                      flag to set the subscription if not current.
    --log-analytics-workspace-key   : The Log Analytics workspace key.

Global Arguments
    --debug                       : Increase logging verbosity to show all debug logs.
    --help -h                     : Show this help message and exit.
    --output -o                   : Output format.  Allowed values: json, jsonc, table, tsv.
                                    Default: json.
    --query                       : JMESPath query string. See http://jmespath.org/ for more
                                    information and examples.
    --verbose                     : Increase logging verbosity. Use --debug for full debug logs.

Examples
    Create a container group and specify resources required.
        az container create -g MyResourceGroup --name MyAlpine --image alpine:latest --cpu 1
        --memory 1

    Create a container group with OS type.
        az container create -g MyResourceGroup --name MyWinApp --image winappimage:latest --os-type
        Windows

    Create a container group with public IP address.
        az container create -g MyResourceGroup --name MyAlpine --image alpine:latest --ip-address
        public

    Create a container in a container group with public IP address and UDP port.
        az container create -g MyResourceGroup --name myapp --image myimage:latest --ip-address
        public --ports 8081 --protocol UDP

    Create a container group with starting command line.
        az container create -g MyResourceGroup --name MyAlpine --image alpine:latest --command-line
        "/bin/sh -c '/path to/myscript.sh'"

    Create a container group with envrionment variables.
        az contanier create -g MyResourceGroup --name MyAlpine --image alpine:latest -e key1=value1
        key2=value2

    Create a container group using container image from Azure Container Registry.
        az container create -g MyResourceGroup --name MyAlpine --image
        myAcrRegistry.azurecr.io/alpine:latest --registry-password password

    Create a container group using container image from other private container image registry.
        az container create -g MyResourceGroup --name MyApp --image myimage:latest --cpu 1 --memory
        1.5 --registry-login-server myregistry.com --registry-username username --registry-password
        password

    Create a container in a container group that mounts an Azure File share as volume.
        az container create -g MyResourceGroup --name myapp --image myimage:latest --command-line
        "cat /mnt/azfile/myfile" --azure-file-volume-share-name myshare --azure-file-volume-account-
        name mystorageaccount --azure-file-volume-account-key mystoragekey --azure-file-volume-
        mount-path /mnt/azfile

    Create a container in a container group that mounts a git repo as volume.
        az container create -g MyResourceGroup --name myapp --image myimage:latest --command-line
        "cat /mnt/gitrepo" --gitrepo-url https://github.com/user/myrepo.git --gitrepo-dir ./dir1
        --gitrepo-mount-path /mnt/gitrepo

    Create a container in a container group using a yaml file.
        az container create -g MyResourceGroup -f containerGroup.yaml

    Create a container group using Log Analytics from a workspace name.
        az container create -g MyResourceGroup --name myapp --log-analytics-workspace myworkspace

    Create a container group using Log Analytics from a workspace id and key.
        az container create -g MyResourceGroup --name myapp --log-analytics-workspace workspaceid
        --log-analytics-workspace-key workspacekey

获取Azure容器组的命令

Command
    az container show: Show the details of a container group.

Arguments

Resource Id Arguments
    --ids              : One or more resource IDs (space-delimited). If provided, no other 'Resource
                        Id' arguments should be specified.
    --name -n          : The name of the container group.
    --resource-group -g: Name of resource group. You can configure the default group using `az
                        configure --defaults group=<name>`.

Global Arguments
    --debug            : Increase logging verbosity to show all debug logs.
    --help -h          : Show this help message and exit.
    --output -o        : Output format.  Allowed values: json, jsonc, table, tsv.  Default: json.
    --query            : JMESPath query string. See http://jmespath.org/ for more information and
                        examples.
    --verbose          : Increase logging verbosity. Use --debug for full debug logs.

查看Azure容器组日志的命令

Command
    az container logs: Tail the log of a container group.

Arguments
    --container-name   : The container name to tail the logs.

Resource Id Arguments
    --ids              : One or more resource IDs (space-delimited). If provided, no other 'Resource
                        Id' arguments should be specified.
    --name -n          : The name of the container group.
    --resource-group -g: Name of resource group. You can configure the default group using `az
                        configure --defaults group=<name>`.

Global Arguments
    --debug            : Increase logging verbosity to show all debug logs.
    --help -h          : Show this help message and exit.
    --output -o        : Output format.  Allowed values: json, jsonc, table, tsv.  Default: json.
    --query            : JMESPath query string. See http://jmespath.org/ for more information and
                        examples.
    --verbose          : Increase logging verbosity. Use --debug for full debug logs.

删除Azure容器组的命令

Command
    az container delete: Delete a container group.

Arguments
    --yes -y           : Do not prompt for confirmation.

Resource Id Arguments
    --ids              : One or more resource IDs (space-delimited). If provided, no other 'Resource
                        Id' arguments should be specified.
    --name -n          : The name of the container group.
    --resource-group -g: Name of resource group. You can configure the default group using `az
                        configure --defaults group=<name>`.

Global Arguments
    --debug            : Increase logging verbosity to show all debug logs.
    --help -h          : Show this help message and exit.
    --output -o        : Output format.  Allowed values: json, jsonc, table, tsv.  Default: json.
    --query            : JMESPath query string. See http://jmespath.org/ for more information and
                        examples.
    --verbose          : Increase logging verbosity. Use --debug for full debug logs.

按资源组列出Azure容器组的命令

Command
    az container list: List container groups.

Arguments
    --resource-group -g: Name of resource group. You can configure the default group using `az
                        configure --defaults group=<name>`.

Global Arguments
    --debug            : Increase logging verbosity to show all debug logs.
    --help -h          : Show this help message and exit.
    --output -o        : Output format.  Allowed values: json, jsonc, table, tsv.  Default: json.
    --query            : JMESPath query string. See http://jmespath.org/ for more information and
                        examples.
    --verbose          : Increase logging verbosity. Use --debug for full debug logs.

在运行中的容器中执行命令的命令

Command
    az container exec: Execute a command from within a running container of a container group.
        The most common use case is to open an interactive bash shell. See examples below. This
        command is currently not supported for Windows machines.

Arguments
    --exec-command [Required]: The command to run from within the container.
    --container-name         : The container name where to execute the command. Can be ommitted for
                            container groups with only one container.
    --terminal-col-size      : The col size for the command output.  Default: 80.
    --terminal-row-size      : The row size for the command output.  Default: 20.

Resource Id Arguments
    --ids                    : One or more resource IDs (space-delimited). If provided, no other
                            'Resource Id' arguments should be specified.
    --name -n                : The name of the container group.
    --resource-group -g      : Name of resource group. You can configure the default group using `az
                            configure --defaults group=<name>`.

Global Arguments
    --debug                  : Increase logging verbosity to show all debug logs.
    --help -h                : Show this help message and exit.
    --output -o              : Output format.  Allowed values: json, jsonc, table, tsv.  Default:
                            json.
    --query                  : JMESPath query string. See http://jmespath.org/ for more information
                            and examples.
    --subscription           : Name or ID of subscription. You can configure the default
                            subscription using `az account set -s NAME_OR_ID`".
    --verbose                : Increase logging verbosity. Use --debug for full debug logs.

Examples
    Stream a shell from within an nginx container.
        az container exec -g MyResourceGroup --name mynginx --container-name nginx --exec-command
        "/bin/bash"

连接到容器组的容器的命令

Command
    az container attach: Attach local standard output and error streams to a container in a
    container group.

Arguments
    --container-name   : The container to attach to. If omitted, the first container in the
                        container group will be chosen.

Resource Id Arguments
    --ids              : One or more resource IDs (space delimited). If provided, no other 'Resource
                        Id' arguments should be specified.
    --name -n          : The name of the container group.
    --resource-group -g: Name of resource group. You can configure the default group using `az
                        configure --defaults group=<name>`.

Global Arguments
    --debug            : Increase logging verbosity to show all debug logs.
    --help -h          : Show this help message and exit.
    --output -o        : Output format.  Allowed values: json, jsonc, table, tsv.  Default: json.
    --query            : JMESPath query string. See http://jmespath.org/ for more information and
                        examples.
    --verbose          : Increase logging verbosity. Use --debug for full debug logs.

发布历史

0.3.18

  • 小修复。

0.3.17

  • 小修复。

0.3.16

  • 小修复。

0.3.15

  • container start/restart:添加了–no-wait参数。

0.3.14

  • 小修复。

0.3.13

  • 添加‘az container start’命令

  • 允许在创建容器时使用十进制值设置CPU

0.3.12

  • 更新依赖关系

0.3.11

  • 更新依赖关系

0.3.10

  • 小修复

0.3.9

  • 小修复

0.3.8

  • 导出容器组到yaml时显示身份

0.3.7

  • 使‘私有’成为传递给‘–ip-address’的有效类型

  • 仅允许使用子网ID来设置容器组的虚拟网络

  • 允许使用vnet名称或资源ID来启用使用来自不同资源组的vnets

0.3.6

  • 为容器组添加“–assign-identity”以添加 MSI 身份

  • 添加“–scope”以创建系统分配的 MSI 身份的角色分配

  • 在创建没有长期运行进程的镜像的容器组时显示警告

  • 修复“list”和“show”命令的表格输出问题

0.3.5

  • 一些小改动

0.3.4

  • 添加了重新启动和停止正在运行的容器组的能力

  • 添加“–network-profile”以传递网络配置文件

  • 添加“–subnet”,“–vnet_name”,允许在 VNET 中创建容器组

  • 更新表格输出以显示容器组的状态

0.3.3

  • 添加“–secure-environment-variables”以将安全环境变量传递到容器

0.3.2

  • 在设置订阅时,不需要“–log-analytics-workspace-key”即可使用名称或 ID

0.3.1

  • 将 PyYAML 依赖项更新到 3.13

0.3.0

  • 重大更改:“show”命令在资源丢失时记录错误消息并以退出代码 3 失败

  • 删除非 dockerhub 注册表的用户名和密码要求

  • 修复从 yaml 文件创建容器组时的错误

0.2.1

  • 将 PyYAML 依赖项更新到 4.2b4

0.2.0

  • 默认为 az container create 使用长期运行操作

  • 添加 Log Analytics 参数“–log-analytics-workspace”和“–log-analytics-workspace-key”

  • 添加 –protocol 参数以指定要使用的网络协议

0.1.24

  • 允许以 yaml 格式导出容器组

  • 允许使用 yaml 文件创建或更新容器组

0.1.23

  • 当注册服务器包含在镜像名称中时,不需要为 az container create 提供注册服务器

0.1.22

  • 添加 Git 仓库卷挂载参数“–gitrepo-url”,“–gitrepo-dir”,“–gitrepo-revision”和“–gitrepo-mount-path”

0.1.21

0.1.20

  • 添加了允许在运行中的容器组中执行命令的“az container exec”命令

  • 允许为创建和更新容器组使用表格输出

0.1.19

  • 将“–secrets”和“–secrets-mount-path”选项添加到“az container create”中,以在 ACI 中使用机密

0.1.18

  • 将“–follow”选项添加到“az container logs”中,以进行日志流

  • 添加“az container attach”命令,该命令将本地标准输出和错误流附加到容器组中的容器

0.1.17

  • 小修复

0.1.16

  • 更新 CLI 核心更改

0.1.15

  • 修复了容器日志参数顺序错误的问题

0.1.14

  • 修复了默认端口回归问题

0.1.13

  • 一些小修复

  • 添加了支持打开多个端口

  • 添加了容器组重启策略

  • 添加了将 Azure 文件共享挂载为卷的支持

  • 更新了辅助文档

0.1.12

  • 一些小修复

0.1.11 (2017-09-22)

  • 一些小修复

0.1.10 (2017-09-11)

  • 一些小修复

0.1.9 (2017-08-28)

  • 一些小修复

0.1.8 (2017-08-11)

  • container create: 修复了等于号不允许在环境变量内部使用的问题。

0.1.7 (2017-07-27)

  • 预览版本。

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分布

azure-cli-container-0.3.18.tar.gz (23.3 kB 查看哈希值)

上传时间

构建分布

azure_cli_container-0.3.18-py2.py3-none-any.whl (23.0 kB 查看哈希值)

上传时间 Python 2 Python 3

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面