Update Environment Variables for Docker Container
When starting a docker image, you can pass environment variables like this:
#-e, --env NAME=hello
docker run -d --name=IMAGE_NAME -e NAME=hello
Now, the image is running, what about you want to change any env var?
- Get the contaienr id:
$ docker container ls
- Stop Docker:
$ service docker stop
- Go to the
containers
directory:$ cd /var/lib/docker/containers
- Open the directory starting with your container id.
- Open
config.v2.json
and change the env var.