如何更改 SageMaker Docker 容器的共享内存?
我在弹性容器注册表(ECR)中有一个Docker图像。它是通过我控制的简单Dockerfile创建的。
图像本身很好,但是我有一个问题,即在Sagemaker Studio中的容器内部工作时共享内存不足。因此,我需要提高这些容器的共享记忆。
为了提高容器的共享内存,我相信通常的方法是- SHM-SIZE
参数参数在启动容器时Docker Run
命令。但是,我无法控制这个命令,因为萨格人为我做了这一点。 Sagemaker正在运行Docker Run< image>训练
启动容器时。
可以解决这个问题吗?通过以某种方式向命令提供其他参数,或者在创建Docker映像时指定某些内容(例如在Dockerfile中,部署脚本到ECR)。
I have a Docker image in Elastic Container Registry (ECR). It was created via a simple Dockerfile which I have control over.
The image itself is fine, but I have a problem where the shared memory is insufficient when working inside a container in SageMaker Studio. Therefore I need to raise the shared memory of these containers.
To raise the shared memory of a container, I believe the usual method is to pass the --shm-size
argument to the docker run
command when starting the container. However, I do not have control over this command, as SageMaker is doing that bit for me. The docs say that SageMaker is running docker run <image> train
when starting a container.
Is it possible to work around this problem? Either via somehow providing additional arguments to the command, or specifying something when creating the Docker image (such as in the Dockerfile, deployment script to ECR).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据 this 问题,您没有可以在 sagemaker 中使用的选项那一刻。如果 ECS 适合您,它确实支持任务定义中的
--shm-size
选项。According to this issue there is no option you can use in sagemaker at the moment. If ECS is an option for you, it does support
--shm-size
option in the task definition.正如 @rok 所指出的(谢谢!)在这种情况下不可能将参数传递给 docker run,尽管如果切换到 ECS 则可以。
但是,在构建镜像以推送到 ECR 时,可以将
--shm-size
参数传递给docker build
。这似乎已经解决了问题,尽管每当想要更改此参数时确实需要构建并推送新的 Docker 映像。As pointed out by @rok (thank you!) it is not possible in this situation to pass arguments to
docker run
, although it would be if switching to ECS.It is however possible to pass the
--shm-size
argument todocker build
when building the image to push to ECR. This seems to have fixed the problem, albeit it does require a new Docker image to be built and pushed whenever wanting to change this parameter.