March 25, 2017

Data-only Containers

Data-only Containers

Container volumes are containers that store and can share data, either exclusively as with data-only containers or as a side-benefit of regular containers with mounted volumes. Data-only containers take up no more resources than needed to provide storage services. They are instantiated via docker create or the VOLUME instruction in a Dockerfile.
  • Use docker volume create to create a volume at the command line:
    • $ docker volume create --name vol44
     
    The volume can be attach to a container at run-time:
    • $ docker run --rm -it -v vol44:/cvol44 alpine sh
     
  • Volumes can also be created via the VOLUME instruction in a Dockerfile:
    • FROM alpine
      VOLUME /data55
    Describe the intent of the following commands:
    • $ docker build -t vol45:01 .
    • $ docker images
     
    • $ docker inspect b159452444cb
    • $ docker run -d b159452444cb /bin/true
     
    • $ docker run --rm -i -t --volumes-from a010 alpine sh
     
  • Miscellaneous
    • Use docker volume rm <container name | ID> to fully delete a volume from the file-system:
      • $ docker volume rm 89f07c5cddc935717d75d1232fc1bf13f77a1f6fe26f0e13e9afdd3ca02fb053
    • Dangling volumes are those that are no longer being used by any other containers on the system. You can find all dangling volumes using:
      • $ docker volume ls -f dangling=true

 

No comments:

Post a Comment