Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I change the enviroment setting without re building the docker image?

So as I sit and develop my Rails application and I move more settings into the environment section of my docker compose file. I then shut down all containers and rebuild the image. Seems like a lot of work.

Can it be updated without rebuilding the image?

like image 932
Jepzen Avatar asked May 04 '18 08:05

Jepzen


People also ask

Do I have to rebuild docker image every time?

You don't need to rebuild your Docker image in development for each tiny code change. If you mount your code into your dev container, you don't have to build a new image on every code change and iterate faster. It's a great feeling when you make changes and see the results right away!

How do you change environment variables in running containers?

It is not possible to change the environment variables of a running process except from within that process itself. This could be (made to be) possible by allowing to update the environment variable config (via `docker update) and then restarting the containercontainerIn computer science, a container is a class or a data structure whose instances are collections of other objects. In other words, they store objects in an organized way that follows specific access rules. The size of the container depends on the number of objects (elements) it contains.https://en.wikipedia.org › wiki › Container_(abstract_data_type)Container (abstract data type) - Wikipedia.

Are environment variables stored in docker image?

It's not stored (in a file) anywhere. It's passed from Docker to the process running in the container.

How do I override docker compose environment variables?

Overriding a single value in your docker-compose . env file is reasonably simple: just set an environment variable with the same name in your shell before running your docker-compose command.


1 Answers

Just change your env variables in your docker-compose file. And docker-compose up -d will updates your variables without rebuild images. Rebuild images is necessary if you change your dockerfile.

Check this How to reload environment variables in docker-compose container with minimum downtime?

like image 125
Kilian Avatar answered Sep 27 '22 22:09

Kilian