- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我尝试为 EJBCA-ce 创建 Azure 容器实例时我收到一个错误,看不到任何日志。
我期待以下结果:
但我收到以下错误:
Failed to start container my-azure-container-resource-name, Error response: to create containerd task: failed to create container e9e48a_________ffba97: guest RPC failure: failed to find user by uid: 10001: expected exactly 1 user matched '0': unknown
一些背景:
我在 azure 云容器实例上运行容器
我试过
(count: 1) (last timestamp: 2020-11-03 16:04:32+00:00) pulling image "primekey/ejbca-ce:6.15.2.3"
(count: 1) (last timestamp: 2020-11-03 16:04:37+00:00) Successfully pulled image "primekey/ejbca-ce:6.15.2.3"
(count: 28) (last timestamp: 2020-11-03 16:27:52+00:00) Error: Failed to start container aci-pulsy-ccm-ejbca-snd, Error response: to create containerd task: failed to create container e9e48a06807fba124dc29633dab10f6229fdc5583a95eb2b79467fe7cdffba97: guest RPC failure: failed to find user by uid: 10001: expected exactly 1 user matched '0': unknown
the dockerfile from dockerhub 的摘录
USER 0
有关和
USER 10001
我们在 dockerfile 中发现了几次。
COPY dir:89ead00b20d79e0110fefa4ac30a827722309baa7d7d74bf99910b35c665d200 in /
/bin/sh -c rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
CMD ["/bin/bash"]
USER 0
COPY dir:893e424bc63d1872ee580dfed4125a0bef1fa452b8ae89aa267d83063ce36025 in /opt/primekey
COPY dir:756f0fe274b13cf418a2e3222e3f6c2e676b174f747ac059a95711db0097f283 in /licenses
USER 10001
CMD ["/opt/primekey/wildfly-14.0.1.Final/bin/standalone.sh" "-b" "0.0.0.0"
MAINTAINER PrimeKey Solutions AB
ARG releaseTag
ARG releaseEdition
ARM模板
{
"type": "Microsoft.ContainerInstance/containerGroups",
"apiVersion": "2019-12-01",
"name": "[variables('ejbcaContainerGroupName')]",
"location": "[parameters('location')]",
"tags": "[variables('tags')]",
"dependsOn": [
"[resourceId('Microsoft.DBforMariaDB/servers', variables('ejbcaMariadbServerName'))]",
"[resourceId('Microsoft.DBforMariaDB/servers/databases', variables('ejbcaMariadbServerName'), variables('ejbcaMariadbDatabaseName'))]"
],
"properties": {
"sku": "Standard",
"containers": [
{
"name": "[variables('ejbcaContainerName')]",
"properties": {
"image": "primekey/ejbca-ce:6.15.2.3",
"ports": [
{
"protocol": "TCP",
"port": 443
},
{
"protocol": "TCP",
"port": 8443
}
],
"environmentVariables": [
{
"name": "DATABASE_USER",
"value": "[concat(parameters('mariadbUser'),'@', variables('ejbcaMariadbServerName'))]"
},
{
"name": "DATABASE_JDBC_URL",
"value": "[variables('ejbcaEnvVariableJdbcUrl')]"
},
{
"name": "DATABASE_PASSWORD",
"secureValue": "[parameters('mariadbAdminPassword')]"
}
],
"resources": {
"requests": {
"memoryInGB": 1.5,
"cpu": 2
}
}
,
"volumeMounts": [
{
"name": "certificates",
"mountPath": "/mnt/external/secrets"
}
]
}
}
],
"initContainers": [],
"restartPolicy": "OnFailure",
"ipAddress": {
"ports": [
{
"protocol": "TCP",
"port": 443
},
{
"protocol": "TCP",
"port": 8443
}
],
"type": "Public",
"dnsNameLabel": "[parameters('ejbcaContainerGroupDNSLabel')]"
},
"osType": "Linux",
"volumes": [
{
"name": "certificates",
"azureFile": {
"shareName": "[parameters('ejbcaCertsFileShareName')]",
"storageAccountName": "[parameters('ejbcaStorageAccountName')]",
"storageAccountKey": "[parameters('ejbcaStorageAccountKey')]"
}
}
]
}
}
它在我的本地机器上的 linux (ubuntu 20.04) 上运行良好
docker run -it --rm -p 8080:8080 -p 8443:8443 -h localhost -e DATABASE_USER="mymaridbuser@my-db" -e DATABASE_JDBC_URL="jdbc:mariadb://my-azure-domain.mariadb.database.azure.com:3306/ejbca?useSSL=true" -e DATABASE_PASSWORD="my-pwd" primekey/ejbca-ce:6.15.2.3
最佳答案
在 EJBCA-ce 容器镜像中,我认为他们试图提供一个不同于 root
的用户。运行 EJBCA 服务器。根据Docker documentation :
The USER instruction sets the user name (or UID) and optionally the user group (or GID) to use when running the image and for any RUN, CMD and ENTRYPOINT instructions that follow it in the Dockerfile
Dockerfile
他们引用了两个用户,
root
, 对应 UID
0
,以及另一个,UID
10001
.
1001
或
10001
,就像在这种情况下。请参阅例如
UID entry in wikipedia或
this article .
USER
指示不需要存在于您的容器中以正确运行它:事实上,如果您在本地运行它,它将毫无问题地启动。
10001
将通过在
CMD
中运行的脚本在您的容器中实际设置在
Dockerfile
中定义,
/opt/primekey/bin/start.sh
,通过这个代码片段:
if ! whoami &> /dev/null; then
if [ -w /etc/passwd ]; then
echo "${APPLICATION_NAME}:x:$(id -u):0:${APPLICATION_NAME} user:/opt:/sbin/nologin" >> /etc/passwd
fi
fi
请注意,
APPLICATION_NAME
在这种情况下,取值
ejbca
以及运行此脚本的用户,如
Dockerfile
中所示, 是
10001
.这将是命令
id -u
提供的值在这段代码中。
docker run -it -p 8080:8080 -p 8443:8443 -h localhost primekey/ejbca-ce:6.15.2.3
并发起
bash
进去:
docker exec -it container_name /bin/bash
如果您运行
whoami
,它会告诉你
ejbca
.
id
它将为您提供以下输出:
uid=10001(ejbca) gid=0(root) groups=0(root)
您可以在
/etc/passwd
中验证用户是否存在还有:
bash-4.2$ cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
systemd-network:x:192:192:systemd Network Management:/:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
ejbca:x:10001:0:ejbca user:/opt:/sbin/nologin
Pierre 没有得到这个输出的原因是因为他运行容器覆盖了提供的
CMD
因此,不执行
start.sh
如上所述,负责创建用户的脚本。
USER
10001
在
Dockerfile
中确定不存在。
containerd
的使用有关。而不是
docker
.
Open Guest Compute Service is a Linux open source project to further the development of a production quality implementation of Linux Hyper-V container on Windows (LCOW). It's designed to run inside a custom Linux OS for supporting Linux container payload.
The focus of LCOW v2 as a replacement of LCOW v1 is through the coordination and work that has gone into containerd/containerd and its Runtime V2 interface. To see our containerd hostside shim please look here Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1.
spec.go
您可以在他们的代码库中找到的文件,当他们尝试建立代表应该运行容器进程的用户时:
func setUserID(spec *oci.Spec, uid int) error {
u, err := getUser(spec, func(u user.User) bool {
return u.Uid == uid
})
if err != nil {
return errors.Wrapf(err, "failed to find user by uid: %d", uid)
}
spec.Process.User.UID, spec.Process.User.GID = uint32(u.Uid), uint32(u.Gid)
return nil
}
此代码由其他代码片段执行 - 您可以看到
full function code here :
parts := strings.Split(userstr, ":")
switch len(parts) {
case 1:
v, err := strconv.Atoi(parts[0])
if err != nil {
// evaluate username to uid/gid
return setUsername(spec, userstr)
}
return setUserID(spec, int(v))
和
getUser
功能:
func getUser(spec *oci.Spec, filter func(user.User) bool) (user.User, error) {
users, err := user.ParsePasswdFileFilter(filepath.Join(spec.Root.Path, "/etc/passwd"), filter)
if err != nil {
return user.User{}, err
}
if len(users) != 1 {
return user.User{}, errors.Errorf("expected exactly 1 user matched '%d'", len(users))
}
return users[0], nil
}
如您所见,这些正是 Azure 报告给您的错误。
containerd
运行容器.
containerd
基于 Windows 和上述软件的运行时实现,这就是容器现在失败的原因。
10001
,正如皮埃尔指出的那样。
Dockerfile
.例如,您可以尝试:
FROM primekey/ejbca-ce:6.15.2.3
USER 0
RUN echo "ejbca:x:10001:0:ejbca user:/opt:/sbin/nologin" >> /etc/passwd
USER 10001
请注意,您可能需要从官方 EJBCA 镜像中定义一些环境变量。
Dockerfile
您可以使用
docker
构建您的图像或 docker compose 与一个适当的
docker-compose.yaml
文件,类似于:
version: "3"
services:
ejbca:
image: <your repository>/ejbca
build: .
ports:
- "8080:8080"
- "8443:8443"
请按照您认为合适的方式对其进行自定义。
关于azure - 在 azure 上创建 ejbca docker 容器时出现 containerd 错误 "failed to find user by uid",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64667740/
这东西现在真的很困惑。有人可以解释发生了什么。只是直线上的区别。 dockerd libcontainerd 容器 docker-containerd docker-runc docker-conta
我在 Ubuntu 18.04.2 上安装了 docker。 当我尝试启动 docker 时,它会失败并显示以下错误日志。 2020-07-16T23:49:14Z docker.dockerd[93
When I run containerd on my Windows 11 box当我在Windows 11系统上运行Containerd时 ctr images pull mcr.micr
docker安装后,我尝试运行 docker run --rm hello-world 并得到这个错误: docker: Error response from daemon: runtime "io
关于如何解决这个问题有很好的解释。 SOF Q1 , SOF Q2以及更多关于 SOF 和互联网的相关问题。 我担心的是,是什么导致了这个问题,以及为什么 docker 最终会处于这种状态。 (/va
当我尝试通过以下方式杀死 Docker 守护进程时: docker kill $(docker ps -q) 我收到以下错误: Error response from daemon: Cannot k
随着containerd应用越来越广泛,我们必须紧跟官网的节奏。 之前配置https私有镜像仓库的方法比较繁琐,并且不易梳理,下边介绍一下目前最新的配置方法。 配置https私有镜像仓库 我假设你
我在 docker-in-docker (dind) 场景中运行了这样的命令: docker daemon --host=unix:///var/run/docker.sock --host=tcp:
Docker作为非常流行的容器技术,之前经常有文章说它被K8S弃用了,取而代之的是另一种容器技术containerd!其实containerd只是从Docker中分离出来的底层容器运行时,使用起来和
哈喽大家好,我是咸鱼。 好久没发文了,最近这段时间都在学 K8S。不知道大家是不是和咸鱼一样,刚开始学 K8S、Docker 的时候,往往被 CRI、OCI、CRI shim、containerd
我是 containerd 的新手,正在尝试使用 Containerd 运行一个简单的应用程序。我正在使用 ctr 访问图像、容器和任务。 在 Docker 的情况下,我曾经将命令作为 docker
它has been stated那: The shim allows for daemonless containers. It basically sits as the parent of the
又过了好久没写了,主要是近来状况也无聊 。 1、了解概念( 参考 ) 概念 Kubernetes 是一个可移植、可扩展的开源平台,用于管理容器化的工作负载和服务,可促进声明式配置和自动
我们的一个虚拟机已重启,现在 docker 无法启动。当我尝试通过 systemctl start docker-standalone 启动服务时,我得到: Job for docker-standa
嗨,我正在尝试在我的 Debian 10 计算机上安装 docker,但在尝试安装 containerd.io 服务时遇到了一些问题。 当我尝试使用此命令进行安装时,出现错误,提示我需要升级依赖项。但
刚刚按照 Ubuntu 14.04 中的存储库的官方说明安装了 Docker CE 安装成功,守护进程正在运行 $ ps aux | grep docker [...] /usr/bin/docker
这两者如何比较? 据我了解,runc 是容器的运行时环境。这意味着该组件提供了运行容器所需的环境。那么 containerd 的作用是什么呢? 如果它负责其余的工作(网络、卷管理等),那么 Docke
什么是RunC Docker、Google、CoreOS 和其他供应商创建了开放容器计划 (OCI),目前主要有两个标准文档:容器运行时标准 (runtime spec)和 容器镜像标准(im
前面我们介绍了 containerd 的基本使用,也了解了如何将现有 docker 容器运行时的 Kubernetes 集群切换成 containerd,接下来我们使用 kubeadm 从头搭建
前面我们介绍了可以使用 ctr 操作管理 containerd 镜像容器,但是大家都习惯了使用 docker cli,ctr 使用起来可能还是不太顺手,为了能够让大家更好的转到 containe
我是一名优秀的程序员,十分优秀!