鍍金池/ 問答/Linux  網(wǎng)絡(luò)安全/ dockerfile中 RUN 怎么寫換行代碼

dockerfile中 RUN 怎么寫換行代碼

例如想要執(zhí)行這個

tee /root/.pip/pip.conf <<-'EOF'
[global]
index-url = https://pypi.douban.com/simple/
EOF

在dockerfile中怎么寫, 直接寫是不行的, 如果寫成以下的形式, 會變成單行, 不能滿足原格式要求

RUN tee /root/.pip/pip.conf <<-'EOF' \
[global] \
index-url = https://pypi.douban.com/simple/ \
EOF

請指教

回答
編輯回答
不二心

使用換行符啊 \n

echo "[global]\nindex-url = https://pypi.douban.com/simple/\n" > /root/.pip/pip.conf
2017年12月10日 01:35
編輯回答
卟乖

直接COPY文件

2017年10月10日 06:26