在 Azure 中,我们尝试使用 Azure 容器实例和准备好的 YAML 创建容器。从执行 az container create 命令的计算机上,我们可以成功登录到我们的私有注册表(例如 fa-docker-snapshot-local.docker.comp.devJFrog 人工制品厂)输入密码后我们也可以 docker pull 它
docker login fa-docker-snapshot-local.docker.comp.dev -u svc-faselect
Login succeeded
这样我们就可以成功拉取它,并且图像路径与手动执行 docker pull 时相同:
image: fa-docker-snapshot-local.docker.comp.dev/fa/ads:test1
我们有用于部署的 YAML 文件,并尝试使用同一服务器上的 az 命令创建容器。在 YAML 文件中,我们设置了相同的注册表信息:服务器、用户名和密码以及相同的图像
az container create --resource-group FRONT-SELECT-NA2 --file ads-azure.yaml
当我们尝试执行此命令时,需要 30 分钟,然后显示消息:“部署失败。操作失败,状态 200:资源状态失败”
完整的Yaml:
apiVersion: '2019-12-01'
location: eastus2
name: ads-test-group
properties:
containers:
- name: front-arena-ads-test
properties:
image: fa-docker-snapshot-local.docker.comp.dev/fa/ads:test1
environmentVariables:
- name: 'DBTYPE'
value: 'odbc'
command:
- /opt/front/arena/sbin/ads_start
- ads_start
- '-unicode'
- '-db_server test01'
- '-db_name HEDGE2_ADM_Test1'
- '-db_user sqldbadmin'
- '-db_password pass'
- '-db_client_user HEDGE2_ADM_Test1'
- '-db_client_password Password55'
ports:
- port: 9000
protocol: TCP
resources:
requests:
cpu: 1.0
memoryInGB: 4
volumeMounts:
- mountPath: /opt/front/arena/host
name: ads-filesharevolume
imageRegistryCredentials: # Credentials to pull a private image
- server: fa-docker-snapshot-local.docker.comp.dev
username: svcacct-faselect
password: test
ipAddress:
type: Private
ports:
- protocol: tcp
port: '9000'
volumes:
- name: ads-filesharevolume
azureFile:
sharename: azurecontainershare
storageAccountName: frontarenastorage
storageAccountKey: kdUDK97MEB308N=
networkProfile:
id: /subscriptions/746feu-1537-1007-b705-0f895fc0f7ea/resourceGroups/SELECT-NA2/providers/Microsoft.Network/networkProfiles/fa-aci-test-networkProfile
osType: Linux
restartPolicy: Always
tags: null
type: Microsoft.ContainerInstance/containerGroups
您能帮我们看看为什么会出现这个错误吗?
谢谢
据我所知,你的YAML文件没有任何问题,我只能给你一些可能的原因。
- 确保配置正确,服务器 URL、用户名和密码,还包括图像名称和标签;
- 更改端口从
'9000' into
9000``,我的意思是删除双引号;
- 看看Note https://learn.microsoft.com/en-us/azure/container-instances/container-instances-volume-azure-files,也许安装卷会导致容器崩溃。然后你需要将文件共享挂载到一个新文件夹,我的意思是之前不存在的新文件夹。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)