- Deployment with Docker
- Srdjan Grubor
- 160字
- 2021-07-02 23:22:13
Setting environment variables with ENV
ENV, unlike some of these other commands, should be mostly self-explanatory: it sets the environmental variables both in the Dockerfile and the container. Since we would need to keep re-typing /srv/www/html in our Dockerfile, in order to prevent typos and to ensure easy changes to our final server directory target, we set the SRV_PATH variable that we keep reusing with $SRV_PATH later. Generally for Docker containers, almost all the configurations to containers are done through environmental variables such as these, so expect to see this directive more in the later chapters.
Even though we don't use it in this example, you need to watch out when using environment variables in the CMD directive directly as it does not get expanded but runs directly. You can ensure that your variable gets expanded in CMD by using it as part of a shell command structure similar to this: CMD [ "sh", "-c", "echo", "$SRV_PATH" ].
- Deep Learning Quick Reference
- SCRATCH與機(jī)器人
- 3D Printing with RepRap Cookbook
- 輕松學(xué)Java
- 工業(yè)機(jī)器人工程應(yīng)用虛擬仿真教程:MotoSim EG-VRC
- 大學(xué)計(jì)算機(jī)應(yīng)用基礎(chǔ)
- 新手學(xué)電腦快速入門
- 工業(yè)機(jī)器人應(yīng)用案例集錦
- 云計(jì)算和大數(shù)據(jù)的應(yīng)用
- 筆記本電腦電路分析與故障診斷
- 智能制造系統(tǒng)及關(guān)鍵使能技術(shù)
- Python文本分析
- 計(jì)算機(jī)硬件技術(shù)基礎(chǔ)學(xué)習(xí)指導(dǎo)與練習(xí)
- 基于元胞自動(dòng)機(jī)的人群疏散系統(tǒng)建模與分析
- 天才與算法:人腦與AI的數(shù)學(xué)思維