Skip to content

Commit

Permalink
Update docker_2.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
toniher authored Oct 9, 2023
1 parent 5195687 commit 2fe0f3d
Showing 1 changed file with 0 additions and 52 deletions.
52 changes: 0 additions & 52 deletions docs/docker_2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -340,55 +340,3 @@ Build and run:

</details>

Additional commands
===================

* **docker inspect**: Get details from containers (both running and stopped). Things such as IPs, volumes, etc.

* **docker logs**: Get *console* messages from running containers. Useful when using with web services.

* **docker commit**: Turn a container into an image. It make senses to use when modifying container interactively. However this is bad for reproducibility if no steps are saved.

Good for long-term reproducibility and for critical production environments:


* **docker save**: Save an image into an image tar archive.

* **docker load**: Load an image tar archive to become an image.

* **docker export**: Save a container filesystem into a tar archive.

* **docker import**: Import a filesystem tar archive into an image (you need to specify a target tag).


Example dealing with tar images
-------------------------------

.. code-block:: console
# Let's save the image in a tar
docker save -o random_numbers.tar random_numbers
# Remove the original image
docker rmi random_numbers
# Check existing images now
docker images
# Recover it
docker load < random_numbers.tar
# Check now images
docker images
Note about the tar formats
--------------------------

* If you check the tar archives generated thanks to **save** with the ones using export, you will notice they do not look the same.

* The former ones ressemble more what you will find in ``/var/lib/docker`` (that is where Docker daemon stores its data) and it includes metadata information (so it is not necessary to specify an image tag).

* On the other hand, tar files generated with **export** they simply contantain the image filesystem. You lost that way a lot of metadata associated to the original image, such as the tags, but also things such as ENTRYPOINT and CMD instructions.


0 comments on commit 2fe0f3d

Please sign in to comment.