You are here
Home > Software Development > DevOps > Docker Cheatsheet

Docker Cheatsheet

Docker provides a way to run applications securely isolated in a container, packaged with all its dependencies and libraries.


1. docker in linux can run dotnet
2. docker in windows can run linux

An image is a lightweight, stand-alone, executable package that includes everything needed to run a piece of software,
including the code, a runtime, libraries, environment variables, and config files.

A container is a runtime instance of an image—what the image becomes in memory when actually executed.
It runs completely isolated from the host environment by default, only accessing host files and ports if configured to do so.

“Dockerized” cluster called a swarm

Displaying Docker Images
To see the list of Docker images on the system, you can issue the following command.
$docker images

Downloading Docker Images
Images can be downloaded from Docker Hub using the Docker run command. Let’s see in detail how we can do this.
$docker run imagename
Removing Docker Images
The Docker images on the system can be removed via the docker rmi command. Let’s look at this command in more detail.
$docker rmi ImageID

docker inspect
This command is used see the details of an image or container.
$docker inspect Repository
Running a Container
Running of containers is managed with the Docker run command. To run a container in an interactive mode, first launch the Docker container.
$docker run –it centos /bin/bash

Listing of Containers
One can list all of the containers on the machine via the docker ps command. This command is used to return the currently running containers.
docker ps
docker ps -a

docker top
With this command, you can see the top processes within a container.
docker top ContainerID

docker stop
This command is used to stop a running container.
docker stop ContainerID

docker rm
This command is used to delete a container.
docker rm ContainerID
docker stats
This command is used to provide the statistics of a running container.
docker stats ContainerID

docker attach
This command is used to attach to a running container.
docker attach ContainerID

docker run -p 8080:8080 -p 50000:50000 jenkins

docker run -d foo

docker build -t myimage:01
docker run -p 81:80 -p 443:443

Leave a Reply