简体   繁体   English

如何在Dockerfile中组合ENV语句?

[英]How can I combine ENV statement in Dockerfile?

As an exameple with the RUN statement, if my code is: 作为RUN语句的exameple,如果我的代码是:

RUN apt-get update
RUN apt-get install git
RUN apt-get clean

I can do: 我可以:

RUN apt-get update && apt-get install git && apt-get clean

If my ENV is: 如果我的ENV是:

ENV POSTGRES_PASSWORD postgres
ENV POSTGRES_USER postgres
ENV POSTGRES_DB postgres
ENV POSTGRES_HOST db

How can I combine ENV statement in one line? 如何将ENV语句组合在一行中?

Example from the Dockerfile reference Dockerfile引用中的示例

https://docs.docker.com/engine/reference/builder/#env https://docs.docker.com/engine/reference/builder/#env

ENV myName="John Doe" myDog=Rex\ The\ Dog \
    myCat=fluffy

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM