零 摘要
本文主要介绍 docker 以linux 系列制作的容器的环境变量。并以gitlabrunner 为例。
解决给docker 容器配置了环境变量但是容器运行时又没有生效。
比如给gitlabrunner 配置了mvn java 环境变量,然后gitlab 集成gitlabrunner 时没有生效。
一 环境信息
1.1. gitlabrunner 14.10.1
二 准备知识
2.1 linux shell
我们知道linux 的环境变量一般都配置在/etc/profile (全局环境变量)或者个人用户下的 .bash_profile 等文件。但linux 不同的登录方式会有不同的加载配置文件方式。
https://www.vanimpe.eu/2014/01/18/different–shell–types–interactive–non–interactive–login/
2.1.1 A login shell
A login shell is the shell that is run when you log in to a system, either via the terminal or via SSH.
Why is this important? If you run a login shell it executes a number of files on startup. This can influence how your system behaves and you have to put your environment variables in these files. The files that are run are
2.1.2 An interactive shell
An interactive shell is when you type in the name of the shell after you have logged in to the system. For example