Skip to content
wangb edited this page Apr 24, 2018 · 1 revision

Concept

  • Image
    • is a special filesystem
    • layer structure
  • Container
    • running instance
    • layer structure
    • lost storage while container is stopped or closed
    • Volume: data persistent
  • Repository

Image

  • get images from docker registry: docker pull repo
  • run an image: docker run repo
  • list images: docker image ls
  • delete images: docker image rm
  • commit changes on container to new image: docker diff, docker commit
  • customize: docker build builds an image from a Dockerfile and a context
    • FROM: base image
    • RUN: each directive create a new commit
    • COPY, ADD: copy file from context, ADD is more advance version of COPY
    • CMD: run the container process. Once the process exit, container stop.
    • VOLUME: define anyonmouse volume mount point
    • EXPOSE: expose container port to host

Volumes

  • create a volume: docker volume create
  • mount a volume: --mount

Compose

Defining and running multi-container Docker applications

Clone this wiki locally