Docker: Difference between revisions

From Wiki RB4
Line 37: Line 37:
  docker rm <CONTAINER_NAME>
  docker rm <CONTAINER_NAME>


  docker rmi <IMAGE_NAME> // delete an image
  docker rmi <IMAGE_NAME> // deletes an image
 
docker run <IMAGE_NAME>


  docker start
  docker start
  docker stop <CONTAINER_NAME>
  docker stop <CONTAINER_NAME>
  docker volume (create | ls | rm | prune | …) // /var/lib/docker/volumes/<VOLUME_NAME>
  docker volume (create | ls | rm | prune | …) // /var/lib/docker/volumes/<VOLUME_NAME>

Revision as of 12:38, 31 August 2021

Resources

History

Docker container technology was launched in 2013 as an open source Docker Engine. It leveraged existing computing concepts around containers and specifically in the Linux world, primitives known as cgroups and namespaces. Docker's technology is unique because it focuses on the requirements of developers and systems operators to separate application dependencies from infrastructure. Success in the Linux world drove a partnership with Microsoft that brought Docker containers and its functionality to Windows Server (sometimes referred to as Docker Windows containers).

Concepts

  • Docker runs on a Host Operating System.
  • Docker client is accessed via terminal (Powershell, Linux shell, …).

Container

  • A Docker container is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings, but in difference to VMs it does not include the (guest) OS layer (difference between Docker and VMs see here).
  • Containers isolate software from its environment and ensure that it works uniformly despite differences for instance between development and staging.
  • A docker container is running on the Docker engine (lightweight container). Multiple container can run on the same environment.

Images

  • A Docker image is a template with instructions for creating Docker containers and is build using a file called Docker file. The Docker image is stored in the Docker Hub or in a registry.
  • Docker image ---> commands (pull from repository, …) ---> Docker container

Volumes

  • Volumes are folder on the host which are mounted to a container.

Commands

docker exec
docker image (ls | prune | remove <IMAGE_NAME>)
docker images // lists all images
docker network create
docker run [<RUN_OPTIONS>]  <IMAGE_NAME> [<COMMANDS>] [<ARGS>]
// -d detach, run in background
docker ps // lists all running containers
// -a all
docker rm <CONTAINER_NAME>
docker rmi <IMAGE_NAME> // deletes an image
docker run <IMAGE_NAME>
docker start
docker stop <CONTAINER_NAME>
docker volume (create | ls | rm | prune | …) // /var/lib/docker/volumes/<VOLUME_NAME>