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?

  1. Get the contaienr id: $ docker container ls
  2. Stop Docker: $ service docker stop
  3. Go to the containers directory: $ cd /var/lib/docker/containers
  4. Open the directory starting with your container id.
  5. Open config.v2.json and change the env var.