把docker容器中的环境变量文件拷贝到主机上
41e260ab9035为docker容器ID
docker cp 41e260ab9035:/etc/profile profile
vi profile
在profile文件最后添加上下面的内容:
MAVEN_HOME=/usr/share/maven
PATH=$MAVEN_HOME/bin:$PATH
export MAVEN_HOME PATH
把修改好的文件复制回容器
docker cp profile 41e260ab9035:/etc/profile
进入 docker容器中
docker exec -it 41e260ab9035 /bin/bash
source /etc/profile
本文讲述了如何从Docker容器41e260ab9035中拷贝环境变量文件`/etc/profile`到主机,然后在profile中添加MAVEN_HOME和PATH配置,最后将修改后的文件同步回容器并验证配置。
3604

被折叠的 条评论
为什么被折叠?



