Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly.

Basics Link to heading

  • Container - isolated processe for each of your app’s components. Each component runs in its own isolated environment, completely isolated from everything else on your machine.
  • Image - a standardized package that includes all of the files, binaries, libraries, and configurations to run a container.
  • Registry - a centralized location for storing and sharing your container images. It can be either public or private.
  • Docker Engine - an open source containerization technology for building and containerizing your applications.
  • Docker Compose - a tool for defining and running multi-container applications. you can define all of your containers and their configurations in a single YAML file.
  • Docker Desktop - a one-click-install application for your Mac, Linux, or Windows environment that lets you build, share, and run containerized applications and microservices.
  • Docker Hub - the world’s largest container registry for storing, managing, and sharing Docker images.
  • Docker Scout - a solution for proactively enhancing your software supply chain security.

Command Link to heading

Start a container Link to heading

docker run -d -p host-port:container-port docker/name-of-image

# e.g. docker run -d -p 8080:80 docker/welcome-to-docker

# options
# -d - Run the container in detached mode (background)
# --name - Name the container
# -e - Set environment variables
# -p - Map port

List all running containers Link to heading

docker ps

Stop a container Link to heading

docker stop the-container-id

# e.g. docker stop 8884ac2aad34

List all images Link to heading

docker images

Delete a image Link to heading

docker rmi the-image-id

# e.g. docker stop c1f619b6477e

Get into a running container’s shell Link to heading

docker exec -it container ID/Name sh

# e.g. docker exec -it b7a9f5eb6b85 sh

Get Docker version Link to heading

docker -v

Reference Link to heading