- 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" ].
- PPT,要你好看
- Mastering Mesos
- 基于LPC3250的嵌入式Linux系統開發
- Dreamweaver CS3網頁設計與網站建設詳解
- Java開發技術全程指南
- 人工智能工程化:應用落地與中臺構建
- 大型數據庫管理系統技術、應用與實例分析:SQL Server 2005
- 水晶石精粹:3ds max & ZBrush三維數字靜幀藝術
- 人工智能趣味入門:光環板程序設計
- Grome Terrain Modeling with Ogre3D,UDK,and Unity3D
- Word 2007,Excel 2007辦公應用融會貫通
- Excel 2010函數與公式速查手冊
- Web璀璨:Silverlight應用技術完全指南
- FANUC工業機器人配置與編程技術
- AMK伺服控制系統原理及應用