What does docker env mean?

藏色散人
Release: 2020-05-16 11:37:41
Original
4722 people have browsed it

What does docker env mean?

What does docker env mean?

1. The ENV instruction in the Dockerfile is used to define the environment variables of the image. An example is as follows:

RUN set -ex && apt-get update && apt-get install -y iputils-ping
ENV PATH /usr/local/bin:$PATH
ENV LANG C.UTF-8
ENV TERM xterm
ENV PYTHON_VERSION 3.5.3
ENV name1=ping name2=on_ip
CMD $name1 $name2
Copy after login

Description: While defining environment variables, you can reference already defined environment variables.

In the ENV instruction, you can directly reference the following environment variables:

HOME,用户主目录
HOSTNAME,默认容器的主机名
PATH,
TERM,默认xterm
Copy after login

2. Due to the hierarchical file system of the image, the environment variables defined by ENV can only be applied in subsequent layers. The example is as follows :

ENV abc=hello
ENV abc=bye def=$abc
ENV ghi=$abc
Copy after login

Note:

In the result of the above definition, def=hello, ghi=bye

3. After starting the container, in the container instance, you can use the env command View environment variables

env
Copy after login

Recommended: "docker tutorial"

The above is the detailed content of What does docker env mean?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!