- 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" ].
- Internet接入·網絡安全
- Cinema 4D R13 Cookbook
- 并行數據挖掘及性能優化:關聯規則與數據相關性分析
- 數據庫原理與應用技術學習指導
- 最簡數據挖掘
- 分布式多媒體計算機系統
- AWS Certified SysOps Administrator:Associate Guide
- JSF2和RichFaces4使用指南
- Apache Superset Quick Start Guide
- 我也能做CTO之程序員職業規劃
- 步步驚“芯”
- Photoshop CS4數碼照片處理入門、進階與提高
- 單片機C51應用技術
- Raspberry Pi 3 Projects for Java Programmers
- 智能控制技術及其應用