Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Verify Docker Version : docker --version

View system wide Information - docker info

Search Docker Images in its Registry Server : docker search debian

Downloading Docker Container Images : # docker pull <Name-of-Image>

# docker pull centos

Downloading Specific OS version Docker Image : # docker pull ubuntu:14.04

List all Downloaded Docker Container Images : # docker images

Launching a container with ‘docker run’ command :

# docker run -it -p 9000:80 --name=debian_container1 debian

Launching a Container in detach mode

# docker run -it -d -p 9001:80 --name=web_container centos:7

Getting Container Console with ‘docker attach’

# docker attach {container_name or container_id}

List Containers with ‘docker ps’ command

# docker ps

Start, Stop, Restart and Kill Containers

# docker stop db_container

# docker start db_container11

# docker restart db_container1

# docker kill db_container2

Delete / Remove a Container # docker rm db_container2

Delete / Remove Docker Container images # docker rmi ubuntu:14.04

Save and Load Docker Container Image to/from a tar file

# docker save debian -o mydebian.tar

Load Docker Image from tar file. # docker load -i mydebian.tar

Export and Import Container to / from tar archive

# docker export container_name_or_id

# docker export web_container -o web_container.tar


Display History of Docker Image

# docker history {Image_Name_OR_Image_id}

# docker history ubuntu:16.04

Fetching Logs from the Container # docker logs {container_name_or_container_id}

# docker logs xibodocker_cms-web_1

Containers’ resource usage statistics

# docker stats

# docker stats --no-stream

# docker top {Container_Name_OR_ID}

# docker top xibodocker_cms-web_1

Display Container IP address

# docker inspect web_container | grep IPAddress | cut -d '"' -f 4

You might also like