- 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" ].
- 精通MATLAB神經(jīng)網(wǎng)絡(luò)
- Learning Apache Spark 2
- 網(wǎng)絡(luò)組建與互聯(lián)
- Implementing Oracle API Platform Cloud Service
- Lightning Fast Animation in Element 3D
- Hadoop應(yīng)用開發(fā)基礎(chǔ)
- Salesforce for Beginners
- 零起點(diǎn)學(xué)西門子S7-200 PLC
- 網(wǎng)絡(luò)服務(wù)器搭建與管理
- 和機(jī)器人一起進(jìn)化
- 電腦故障排除與維護(hù)終極技巧金典
- Redash v5 Quick Start Guide
- WPF專業(yè)編程指南
- 軟測(cè)之魂
- Hands-On Geospatial Analysis with R and QGIS