Dockerfile中echo使用

Posted wuyongqiang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Dockerfile中echo使用相关的知识,希望对你有一定的参考价值。

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
deb http://mirrors.aliyun.com/debian stretch-proposed-updates main contrib non-free
deb http://mirrors.aliyun.com/debian stretch-updates main contrib non-free
deb http://mirrors.aliyun.com/debian-security/ stretch/updates main non-free contrib
'> /etc/apt/sources.list
RUN apt-get update

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

参考:Multiline Dockerfile syntax

以上是关于Dockerfile中echo使用的主要内容,如果未能解决你的问题,请参考以下文章

linux12 - dockerfile02 --> 实战构建centostomcat

[Linux] 编写Dockerfile文件自动构建镜像

使用 Dockerfile 构建镜像

linux打开终端如何启动scala,如何在终端下运行Scala代码片段?

如何使用Dockerfile构建镜像

linux12 - dockerfile06 --> Dockerfile构建djiango和java