Docker镜像仅在Ubuntu和Windows 10上工作,但在Amazon Linux上失败

mnemlml8  于 2023-06-21  发布在  Docker
关注(0)|答案(2)|浏览(341)

我有一个基于rocker/r-base 4.2.1的Docker镜像,其中包含一个R Shiny App。该映像构建在WSL 2 Ubuntu 20.04上,并成功运行。然后,我用docker save the_image | gzip > the_image.tar.gzas described in the Docker docs将其保存到tar.gz。然后,这个image is loaded到Windows 10和Linux亚马逊2与docker load --input the_image.tar.gz.奇怪的是,该映像在Windows 10上运行良好,但在Amazon Linux上失败:

> docker run the_image
time="2022-10-14T17:35:45.942475641+02:00" level=info msg="starting signal loop" namespace=moby path=/run/docker/containerd/daemon/io.containerd.runtime.v2.task/moby/4adab3705307279e9a188a3b12f54397dac1cdde254d070901700222b02581f1 pid=3255
OpenBLAS blas_thread_init: pthread_create failed for thread 1 of 2: Operation not permitted
OpenBLAS blas_thread_init: RLIMIT_NPROC -1 current, -1 max

R version 4.2.1 (2022-06-23) -- "Funny-Looking Kid"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

During startup - Warning messages:
1: package ‘utils’ in options("defaultPackages") was not found
2: package ‘stats’ in options("defaultPackages") was not found
> shiny::runApp('/root/app')
Error: .onLoad failed in loadNamespace() for 'utils', details:
  call: system(paste(which, shQuote(names[i])), intern = TRUE, ignore.stderr = TRUE)
  error: cannot popen '/usr/bin/which 'uname' 2>/dev/null', probable reason 'Cannot allocate memory'
Execution halted
INFO[2022-10-14T17:35:46.892198957+02:00] ignoring event                                container=4adab3705307279e9a188a3b12f54397dac1cdde254d070901700222b02581f1 module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
INFO[2022-10-14T17:35:46.893071726+02:00] shim disconnected                             id=4adab3705307279e9a188a3b12f54397dac1cdde254d070901700222b02581f1
ERRO[2022-10-14T17:35:46.893157706+02:00] copy shim log                                 error="read /proc/self/fd/14: file already closed"

有人知道这里出了什么问题吗?Thank you!:)

qni6mghb

qni6mghb1#

啊,想明白了:由于某种原因,使用sudo提升命令失败,但有标志--privileged可以使Docker镜像正常运行:

docker run --privileged=true the_image

编辑

小心点!**请记住,--privileged标志为该容器提供了扩展权限,这可能是入侵者的潜在门户。

vecaoik1

vecaoik12#

我没有足够的因果报应,但附议以上。我们的docker镜像在k8生产环境中的部署上按预期运行。但是在我们的RHEL 8开发服务器上抛出了这个错误。@bathyscapher的建议为我们工作!
docker run --privileged=true the_image

相关问题