Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure environment variables for docker

2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "how to configure environment variables in docker". In daily operation, I believe many people have doubts about how to configure environment variables in docker. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to configure environment variables in docker". Next, please follow the editor to study!

In the previous section we introduced the deployment of a complex docker process. A command option-e is involved. The purpose of this command is to pass environment variables. Next I'm going to show you how it works.

First create a container and set the environment variable VINCENT=vincent@qq.com

Docker run-d-name test1-e VINCENT=vincent@qq.com ubuntu:16.04 / bin/sh-c "while true; do sleep 3600; done"

And then we go into this container:

Docker exec-it test1 / bin/bash

View the environment variables:

Root@3392df323c06:/# envHOSTNAME=3392df323c06TERM=xtermLS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01 TLZY01THERZATION 01THERZATION. TXZY01ET31TET31ZYOER .t7ZYO1TOR 31DUBZOLING 01THERAPHY 01TUBZOLING .ZZO1True 31VOUBING. DZOLATOR 31REFOR .GZOLING 01PUBG 31MUBG. LRZO1X 31MUBG. LZO1ANG 31MUBG. 31RZOU01True 31PUBLING. Sartorius 01TOR 31DUBG. RART01TOR 31DUBG. ACETHERM01TOR 31FOR. ZooTOR 01TOR .cpioLING 01THING. CpioLING 01THANG. RZOUOTH 31TUBING 31PUBG. RZO1X 31IN. Cabbages 01AT. JPEGGUOLING. JPEGGUOLING. JPEGGUOY01ING .JPEGGUOLING. JPEGGOULING .GIFOUBING 035WH .bmpOUB01POTER. PNG01Trache.svgY01Trache.svgzshi.mng.mng..mng...mng.01it.mcxroom01it.moved01it.mpgbread 01it.mpegbread 01it.mpegshi.m2vex01boot 35per.mkvv01ut.mkv035uu.webmm01ut.ogmshi.m4v035or .m4v035or.m4v4v01010135WOB035WOLITE .vOB0ITE. QT0ITUE 135purr. Flvake01it.flved01it.flved01it.glang01ting35ver.dlroom01transmission.xcfeng01lead.xwdfolio 01lead.yuv01transfer.cgmshi.cgmali.emfanti.emfang01us.ogvy01author.ogxbox 01gues.ogved01author.ogxbox 01guan.aaclit..flaced00e36mod.flaced00ide.flaced00ide.mid.0036uuu.mKa00u.m00uuu.36uvu.mka00u.m00u.m00uuu..m00u..m00u.m00uu.m00u.m00uu..m00u..m00u..m00u.m00.m00u.m00uu..m00u.m00.m00u.m00.m00uu..m00u.m00uuu..m00uu..m00u.m00 Here is a picture of 36VINCENTINCENTvincenturyq.comPATHUPATHUPATHUPATHUPATHUPATHUPATHUPATHUPATHUPATHUPATHUPATHUPATHUPATHUPATHUPATHUPATHUPATHUGUA

Then you can see our environment variable VINCENT=vincent@qq.com

Therefore, in this way, we can set environment variables for the container to be created in advance. This is very useful for containers. If we have some programs in the container that need to read the environment variable configuration, if the configuration can be changed, then we can configure it flexibly by modifying the environment variable. This is a way to communicate program configuration.

At this point, the study on "how to configure environment variables in docker" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report