Friday, October 18, 2019

Docker 101 - Part2 - Basic operations

In this article, I will walk you through basic Docker commands and how to work with it for creating, managing, and monitoring Docker containers.

Docker version and info


#docker version


#docker info


Default directory for Docker


#cd /var/lib/docker


Pull images


#docker pull centos:latest 


List images


#docker images


Create bridge network


#docker network create -d bridge --subnet 10.0.0.0/24 ps-bridge

List all bridge networks


#brctl show

Inspect a network 


#docker network ls
#docker network inspect <name>




Run a container


#docker run -dt --name centos_test --network ps-bridge centos sleep 900


SSH into a container


#docker exec -it <name> sh


List running containers


#docker ps


List all containers


#docker ps -a

List container stats


#docker stats


Stop a container


#docker stop <Container ID>


Remove a container


#docker rm <Container ID>

Remove an image


#docker rmi <REPOSITORY:TAG>



Hope it was useful. Cheers!

Related posts


References



1 comment: