Tuesday, September 26, 2017

Docker - All the Magic


Understanding It

  • docker is a history recorded of what changed from the original image that the container started off
  • restart (or stop and start) reverts the container to what the image was, so the container is transient by default
  • it may be also possible to revert by tagging the image (yes!)

Maintenance

When it gets sloooow, and the com.docker.hyperkit takes 20% or 30% of CPU or more, try:
  • consider reducing the # of cpu's enabled
  • prune images not referenced by any container (created
    more than 24h ago):

    docker image prune -a --filter "until=24h"
  • prune containers all stopped containers (older than 24h):
    docker container prune --filter "until=24h"
  • prune networks not used by any container (older than 24h):
    docker network prune --filter "until=24h"
  • and possibly prune volumes not used by currently by any container (make sure you don't need the data on them):
    docker volume prune