Skip to content

Instantly share code, notes, and snippets.

@jamesattard
Created March 30, 2017 08:44
Show Gist options
  • Select an option

  • Save jamesattard/e378e71dc9cc280c8889b4f584bd0edb to your computer and use it in GitHub Desktop.

Select an option

Save jamesattard/e378e71dc9cc280c8889b4f584bd0edb to your computer and use it in GitHub Desktop.
# First get ID of running container
$ docker ps
CONTAINER ID ...
5776d1849024 ...
# Next we take a snapshot of the docker container by first pausing (-p) the container
$ docker commit -p 5776d1849024 mysql
e09f9ac65c8b3...
# The commit arg saves the entire snapshot as a docker image with a name mysql:
$ docker images
REPOSITORY TAG IMAGE ID ...
mysql latest 5776d1849024 ...
# To save to a docker repo:
$ docker login
$ docker push mysql
# To save as tarball:
$ docker save -o mysql.tar mysql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment