docker如何改变环境变量
命令&步骤
- 关闭docker 服务
1 | # systemctl stop docker |
2.查看环境变量
1 | # docker exec -it [container-id] env |
查看Docker Root Dir: /apps/docker
1
# docker info
找到容器短id,再docker inspect [短id], 获取容器的长id:container-id
1 | # dokcer ps |
或者
1 | # vim var/lib/docker/containers/[container-id]/config.json |
3.修改环境变量
修改/var/lib/docker/containers/[container-id]/config.v2.json里对应的环境变量
- 修改容器配置信息
1
# vim var/lib/docker/containers/[container-id]/config.v2.json
4.然后重启docker服务
1 | # systemctl daemon-reload |