首页 > 其他 > 详细

Dockerfile中echo使用

时间:2019-11-13 12:46:39      阅读:516      评论:0      收藏:0      [点我收藏+]

Dockerfile 中的echo的使用方式和bash中的使用方式是有区别的
下面是一个 Dockerfile 通过echo的方式更换apt-get源和pip

FROM python:3.5.8-stretch

# 更新缓存
RUN echo 'deb http://mirrors.aliyun.com/debian stretch main contrib non-free\ndeb http://mirrors.aliyun.com/debian stretch-proposed-updates main contrib non-free\ndeb http://mirrors.aliyun.com/debian stretch-updates main contrib non-free\ndeb http://mirrors.aliyun.com/debian-security/ stretch/updates main non-free contrib\n'> /etc/apt/sources.list
RUN apt-get update

# 配置pip
RUN mkdir /root/.pip && echo '[global]\ntrusted-host = mirrors.aliyun.com\nindex-url = https://mirrors.aliyun.com/pypi/simple\n'> /root/.pip/pip.conf

参考:Multiline Dockerfile syntax

Dockerfile中echo使用

原文:https://www.cnblogs.com/wuyongqiang/p/11847881.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!