Docker Commands

# systemctl start docker				(Starting Docker service)

# systemctl enable docker				(Enabling Docker at boot level)

# docker –version						(Checking Docker version)

# docker info							(Gives all information about host and containers)

# docker run/pull image					(images can be downloaded from Docker Hub)

# docker run hello-world				(Just download and start a test container)

# docker run -it ubuntu bash			(It will download and start a ubuntu container with bash shell, -i=interactive, -t=to connect to tty)

# docker images							(It will show you current downloaded images in your system)

# docker images –q						(Only show numeric IDs)

# docker images –a						(Show all images)

# docker images –digests				(show digests of images)

# docker ps								(Shows the running containers)

# docker ps –a							(Shows all containers running/stopped)

# docker pull centos:latest				(It will pull latest centos image)

# docker run -it docker.io/centos /bin/bash		(It will login into contianer)

# docker rmi Container-ID/names			(It will remove the image)

# docker inspect Container-ID/names		(Information about the image/container)

# docker history Container-ID/names		(you can see all the commands that were run with an image via a container)

# docker stats Container-ID/names		(To show CPU and Memory utilization of container)

# docker attach Container-ID/names		(login to the running container)

# docker pause Container-ID/names		(pause the processes in running contaimer)

# docker unpause Container-ID/names		(unpause the paused container)

# docker kill Container-ID/names		(kill running containers)

# docker network ls						(List all Networks)

# docker network ls --no-trunc			(Give full Network ID)

# docker network inspect bridge			(Inspect a Network)

# docker network create --subnet 172.18.0.0/24 --gateway 172.18.0.1 --driver bridge mybridge01 a66ad9fe8d9d7021c1e9be6ab9452579f97a88a4638dd9d8cd1e488003f1f1f8		(Create a Network)

# docker network rm name/network id		(It will remove a network)

# docker logs Container-ID/names		(It will show you logs)

# docker events							(Now do any activity and it will be visible in docker events)

# docker events –since ‘1h’				(Events done in last one hour)

# docker events –filter event=attach 	(Events will be shown once container got attached)	

# docker events –filter=die –filter=stop	(You can add multiple filters)



One thought on “Docker Commands

  • Leave a Reply

    Your email address will not be published. Required fields are marked *