• docker提交镜像到阿里ack整体流程


    本笔记为阿里云天池龙珠计划Docker训练营的学习内容,链接为:https://tianchi.aliyun.com/specials/activity/promotion/aicampdocker;

    ➜  testv0928 mkdir docker_test01
    ➜  testv0928 cd docker_test01 

    使用ack账号登陆docker
    ➜  docker_test01 docker login --username=**** registry.cn-hangzhou.aliyuncs.com
      Password: 
      Login Succeeded
      Logging in with your password grants your terminal complete access to your account. 
      For better security, log in with a limited-privilege personal access token. Learn more at https://docs.docker.com/go/access-tokens/
    ➜  docker_test01 vim math.py
    ➜  docker_test01 vim run.sh
    ➜  docker_test01 cat math.py
      import torch
      device = torch.device("cuda")
      a = torch.randn(3, 3)
      b = torch.randn(3, 3)
      a = a.to(device)
      b = b.to(device)
      c = torch.matmul(a,b)
      print(c)
    ➜  docker_test01 cat run.sh
      #bin/bash
      #打印GPU信息
      nvidia-smi
      #执行math.py
      python3 math.py
    ➜  docker_test01 vim Dockerfile
    ➜  docker_test01 cat Dockerfile 
      # Base Images
      ## 从天池基础镜像构建(from的base img 根据自己的需要更换,建议使用天池open list镜像链接:https://tianchi.aliyun.com/forum/postDetail?postId=67720)
      FROM registry.cn-shanghai.aliyuncs.com/tcc-public/pytorch:1.4-cuda10.1-py3
      
      ##安装依赖包,pip包请在requirements.txt添加
      #RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
      
      ## 把当前文件夹里的文件构建到镜像的//workspace目录下,并设置为默认工作目录
      ADD math.py /workspace
      ADD run.sh /workspace
      WORKDIR /workspace
      
      ## 镜像启动后统一执行 sh run.sh
      CMD ["sh", "run.sh"]
    ➜  docker_test01 docker build -t registry.cn-hangzhou.aliyuncs.com/ly_22_test/docker_test01:01
      "docker build" requires exactly 1 argument.
      See 'docker build --help'.
      
      Usage:  docker build [OPTIONS] PATH | URL | -
      
      Build an image from a Dockerfile
    ➜  docker_test01 ls                                                                           
        Dockerfile math.py    run.sh
    ➜  docker_test01 ll
      total 24
     

  • 相关阅读:
    竞赛选题 深度学习卫星遥感图像检测与识别 -opencv python 目标检测
    golang中移除切片索引位置的元素
    CVE-2020-11978 Apache Airflow 命令注入漏洞分析与利用
    Typora使用教程
    c# List<int[]>转Point
    管理类联考——英语二——阅读篇——题材:教育
    设计模式之模板方法模式
    软考2020高级架构师下午案例分析第4题:关于Redis数据类型、持久化、内存淘汰机制
    shell实现日期加减
    C++【类型转换】
  • 原文地址:https://blog.csdn.net/UNknowmer/article/details/127095716