• Courses
  • Tutorials
  • DSA
  • Data Science
  • Web Tech
August 17, 2022 |150 Views

Using Environmental Variables with Container | Docker

  Share   Like
Description
Discussion

In this video, we'll see the use of environmental variables with container, why we need environmental var in some specific images during run time and example of MySql image with env variable.

In order to distribute software in packages known as containers, Docker is a collection of platforms as a service (PaaS) solutions. Containers can connect with one another over well defined channels and are segregated from one another. They also bundle their own software, libraries, and configuration files. 
Since a single operating system kernel powers all containers, they consume less resources than virtual machines.

Environment variables, or ENVs, essentially dictate how the environment behaves. They may have an impact on running processes or running programs in the environment. Any variable's scope refers to the area from which it can be accessed or the area across which it is defined. In Linux, an environment variable may have either a global or local scope.

Access to a globally scoped ENV defined in a terminal is possible from any location within the terminal's environment. It can therefore be used in any scripts, applications, or processes that are tied to the environment by that terminal. Any program or process executing in the terminal is unable to access a locally scoped ENV that is defined there. Only the terminal (in which it was defined) itself has access to it.