如何在Amazon Linux 2服务器上安装wget?

huangapple go评论81阅读模式
英文:

How to install wget using Amazon Linux 2 server?

问题

Dockerfile:

# 从包含 Python 3.8 的 Lambda 运行时中获取基本镜像
FROM public.ecr.aws/lambda/python:3.8

# 将之前创建的 requirements.txt 文件复制到容器中
COPY requirements.txt ./

# 从 requirements.txt 安装 Python 依赖
RUN python3.8 -m pip install -r requirements.txt

# 创建用于挂载 EFS 的模型目录
RUN mkdir -p /mnt/ml

# 安装 CUDA
RUN apt-get install wget
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/libcudnn8_8.1.0.77-1+cuda11.2_amd64.deb
RUN dpkg -i libcudnn8_8.1.0.77-1+cuda11.2_amd64.deb

# 将之前创建的 app.py 文件复制到容器中
COPY app.py ./
COPY maskrcnn/ ./maskrcnn

# 将 CMD 设置为你的处理程序
CMD ["app.lambda_handler"]

要在 Docker 容器中安装 CUDA,你需要使用基于 Ubuntu 的镜像,因为 apt-get 是 Ubuntu 的包管理工具。你可以考虑使用 nvidia/cuda 或其他带有 CUDA 支持的官方 NVIDIA 镜像,这些镜像已经配置好了 CUDA 和 cuDNN 等 GPU 相关工具。根据你的需求选择合适的 NVIDIA CUDA 镜像来替代 public.ecr.aws/lambda/python:3.8

英文:

I am trying to install CUDA in my container, but, since the public.ecr.aws/lambda/python:3.8 doesn't have wget distribution, I'm getting the following error: /bin/sh: apt-get: command not found

Dockerfile:

# Pull the base image with python 3.8 as a runtime for your Lambda
FROM public.ecr.aws/lambda/python:3.8

# Copy the earlier created requirements.txt file to the container
COPY requirements.txt ./

# Install the python requirements from requirements.txt
RUN python3.8 -m pip install -r requirements.txt 

# Create the model directory for mounting the EFS 
RUN mkdir -p /mnt/ml

# Install CUDA
RUN apt-get install wget
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/libcudnn8_8.1.0.77-1+cuda11.2_amd64.deb
RUN dpkg -i libcudnn8_8.1.0.77-1+cuda11.2_amd64.deb

# Copy the earlier created app.py file to the container
COPY app.py ./
COPY maskrcnn/ ./maskrcnn

# Set the CMD to your handler
CMD ["app.lambda_handler"]

To run my project I am using I am using Amazon Linux 2 as my server.

Do I need to install another image in order to install cuda inside my docker? If yes, what would be the most appropriate image for this case?

答案1

得分: 3

You are attempting to use the Debian/Ubuntu package manager on a Docker image that is based on an AWS Docker image which uses a completely different package manager (Yum).

Maybe change your RUN command to this:

RUN yum -y install wget

However, even after doing this I think you will find you will not be able to find a package to satisfy libcudnn8.

As the true solution to your problem I would suggest you change your base image to ubuntu as this is what your Docker image is more likely suited to by simply renaming the FROM section of your Dockerfile as follows:

FROM ubuntu:latest

英文:

You are attempting to use the Debian/Ubuntu package manager on a Docker image that is based on an AWS Docker image which uses a completely different package manager (Yum).

Maybe change your RUN command to this:

RUN yum -y install wget

However, even after doing this I think you will find you will not be able to find a package to satisfy libcudnn8.

As the true solution to your problem I would suggest you change your base image to ubuntu as this is what your Docker image is more likely suited to by simply renaming the FROM section of your Dockerfile as follows:

FROM ubuntu:latest

huangapple
  • 本文由 发表于 2023年3月9日 20:37:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/75684721.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定