ToB企服应用市场:ToB评测及商务社交产业平台

标题: 在windows 10安装了docker跑github上的项目 [打印本页]

作者: 魏晓东    时间: 2024-12-13 14:49
标题: 在windows 10安装了docker跑github上的项目
  

  
  1. docker pull nvidia/cuda:12.1.1-cudnn8-devel-ubuntu22.04
复制代码

          可以输入 'docker images' 列出本地Docker主机上存储的全部Docker镜像
  1. docker iamges
复制代码

  
  
  1. FROM nvidia/cuda12.1.1-cudnn8-devel-ubuntu22.04
  2. LABEL version="1.0" maintainer="xxxx" Description="basic cuda conda environment"
  3. # 这里用于解决 GPG error 问题, 详见下面补充
  4. RUN apt-key del "7fa2af80" \
  5. && export this_distro="$(cat /etc/os-release | grep '^ID=' | awk -F'=' '{print $2}')" \
  6. && export this_version="$(cat /etc/os-release | grep '^VERSION_ID=' | awk -F'=' '{print $2}' | sed 's/[^0-9]*//g')" \
  7. && apt-key adv --fetch-keys "https://developer.download.nvidia.com/compute/cuda/repos/${this_distro}${this_version}/x86_64/3bf863cc.pub" \
  8. && apt-key adv --fetch-keys "https://developer.download.nvidia.com/compute/machine-learning/repos/${this_distro}${this_version}/x86_64/7fa2af80.pub"
  9. # 安装一些常用的包
  10. RUN apt-get update && apt-get install apt-utils -y
  11. RUN apt-get install wget -y && apt-get install vim -y && apt-get install git -y && apt-get install unzip -y
  12. RUN wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py38_23.1.0-1-Linux-x86_64.sh \
  13.     && sh Miniconda3-py38_23.1.0-1-Linux-x86_64.sh -b \
  14.     && ~/miniconda3/bin/conda init
复制代码
注意:Dockerfile不要有扩展名
  
  1. # 进入dockerfile所在文件目录
复制代码
  1. docker build -t contaicontainer_name:1.0 .
复制代码

  /d/docker/xxxx替换成自己workspace的目次  
  1. sudo docker run  --name container_name --gpus all -d -it -v /d/docker/xxxx:/workspace --net=host --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 -e NVIDIA_DRIVER_CAPABILITIES=all <镜像名>:1.0
复制代码

  'docker ps
'列出当前正在运行的全部Docker容器
  1. docker ps
复制代码

  
  1. docker start container_name
复制代码

  1. docker exec -it container_name /bin/bash
复制代码
进入容器后就可以根据github上的README一步一步安装项目环境啦~
  
  注意:git clone github的项目的时候要先cd workspace
  

  
  
  更多有关于容器的操作可以参考这个https://longxinglx.github.io/posts/Nvidia-Docker/
  
   
  Visual Studio Code-扩展-Docker
  

  
  

  
  


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。




欢迎光临 ToB企服应用市场:ToB评测及商务社交产业平台 (https://dis.qidao123.com/) Powered by Discuz! X3.4