How to commit changes to a Docker image
What happens when you deploy your app, and then you want to fix a bug, or simply release an update?
Once you have a container running, you can get its ID using docker ps
, then you use docker commit
to create a new tag for the image from it:
docker commit <id> <username>/<imagename>:<tagname>
You can also add a changelog message that lists what changed in the new version:
docker commit --change "description" <id> <username>/<imagename>:<tagname>
→ I wrote 17 books to help you become a better developer:
- C Handbook
- Command Line Handbook
- CSS Handbook
- Express Handbook
- Git Cheat Sheet
- Go Handbook
- HTML Handbook
- JS Handbook
- Laravel Handbook
- Next.js Handbook
- Node.js Handbook
- PHP Handbook
- Python Handbook
- React Handbook
- SQL Handbook
- Svelte Handbook
- Swift Handbook
Also, JOIN MY CODING BOOTCAMP, an amazing cohort course that will be a huge step up in your coding career - covering React, Next.js - next edition February 2025