Techno04335
Techno04335

Reputation: 1445

How can I update a specific docker image when changes are applied

Question 1: Do I have to update both the container and the image, or just the image?

Question 2: When I make changes to the data in which the my app uses, how can I update the docker image or container(if necessary), so that the app will show and update data from updated image/container. I have the current docker image running named: test/app1

Here are my current steps:

_1. Rebuild the application using: docker build -t test/app1

_2.Restart Docker using: service docker restart

**After these steps are made there are no errors but the image does not have the updated data. Is this an issue with the Image update or Container.

Thanks.

Upvotes: 1

Views: 306

Answers (1)

Farhad Farahi
Farhad Farahi

Reputation: 39527

First of all you do'nt have to restart docker service!

To answer your first question:

Question 1: Do I have to update both the container and the image, or just the image?

Just update the image, stop old container, docker run new container from new image.

Question 2: When I make changes to the data in which the my app uses, how can I update the docker image or container(if necessary), so that the app will show and update data from updated image/container. I have the current docker image running named: test/app1

Depends on your app data, If its mounted via bind mount, or volume, your just have to update these, If your app requires restart some service to make that data available, you can stop/start the container or remove/recreate it.

If your data is in the image/container, You update the image, stop the old container and recreate it using the new image.

Upvotes: 2

Related Questions