← 返回命令列表

Linux command

az-container 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Create a container instance

az container create -g [resource-group] --name [container-name] --image [image:tag] --cpu [1] --memory [1]

Create with public IP

az container create -g [resource-group] --name [container-name] --image [image:tag] --ports [80] --dns-name-label [myapp]

List container groups

az container list -g [resource-group]

View container logs

az container logs -g [resource-group] --name [container-name]

Execute a command

az container exec -g [resource-group] --name [container-name] --exec-command "[/bin/bash]"

Show container details

az container show -g [resource-group] --name [container-name]

Stop a container group

az container stop -g [resource-group] --name [container-name]

Delete a container group

az container delete -g [resource-group] --name [container-name]

说明

az container manages Azure Container Instances (ACI), providing the fastest way to run containers in Azure without managing virtual machines or adopting orchestration services. ACI is ideal for isolated containers, simple applications, task automation, and build jobs. For scenarios requiring full container orchestration, use Azure Kubernetes Service (AKS).

参数

-g, --resource-group _value_
Name of the resource group
--name _value_
Name of the container group
--image _value_
Container image (e.g., nginx:latest)
--cpu _value_
Number of CPU cores (default: 1)
--memory _value_
Memory in GB (default: 1.5)
--ports _value_
Space-separated list of ports to open
--dns-name-label _value_
DNS name label for the public IP
--os-type _value_
Operating system type: Linux or Windows (default: Linux)
--ip-address _value_
IP address type: Public or Private
--restart-policy _value_
Restart policy: Always, OnFailure, or Never (default: Always)
-e, --environment-variables _key=value_
Environment variables (space-separated key=value pairs)
--secure-environment-variables _key=value_
Secure environment variables (not shown in logs or portal)
--registry-login-server _value_
Private container registry login server

FAQ

What is the az-container command used for?

az container manages Azure Container Instances (ACI), providing the fastest way to run containers in Azure without managing virtual machines or adopting orchestration services. ACI is ideal for isolated containers, simple applications, task automation, and build jobs. For scenarios requiring full container orchestration, use Azure Kubernetes Service (AKS).

How do I run a basic az-container example?

Run `az container create -g [resource-group] --name [container-name] --image [image:tag] --cpu [1] --memory [1]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -g, --resource-group _value_ do in az-container?

Name of the resource group