Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jclosure
Created June 5, 2015 08:07
Show Gist options
  • Star 21 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save jclosure/b2bcf0686739ad6b79df to your computer and use it in GitHub Desktop.
Save jclosure/b2bcf0686739ad6b79df to your computer and use it in GitHub Desktop.
How to revert a docker container to a previous commit
$ docker history imagename
IMAGE CREATED CREATED BY SIZE
f770fc671f11 12 seconds ago apt-get install -y curl 21.3 MB
28445c70c2b3 39 seconds ago apt-get install ping 11.57 MB
8dbd9e392a96 7 months ago 131.5 MB
$ docker tag 2844 imagename # <-- that's the secret right there
$ docker history imagename
IMAGE CREATED CREATED BY SIZE
28445c70c2b3 56 seconds ago apt-get install ping 11.57 MB
8dbd9e392a96 7 months ago 131.5 MB
@bvelastegui
Copy link

Tanks! Works fine 😏

@longerian
Copy link

works fine

@NewtMa
Copy link

NewtMa commented Jan 12, 2021

You are a lifesaver

@sujay1844
Copy link

Thanks mate. Saved my day!!

@mnetir
Copy link

mnetir commented Jul 4, 2021

Works fine

@jrg72
Copy link

jrg72 commented Aug 19, 2021

Works great, I wish the official docs were this clear

@dfurmans
Copy link

amazing! thanks!

@GoingMyWay
Copy link

Great. It works!

@daniyalfarman
Copy link

Hey what to right after docker tag previous image and then?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment