Docker Commands

 Docker Commands


In this article we are going to see some basic commands of Docker which is more important to know all the command and it will be used in your regular work when you are working on docker platform.



i = interactive mode
t = terminal

To see all images present in your local machine:
[user@cmp]# docker images

To find out images in docker hub:
[user@cmp]# docker search ubuntu(name of image)

To download image from dockerhub to local machine:
[user@cmp]# docker pull ubuntu(name of image)

To create container with container name:
[user@cmp]# docker run -it --name ons ubuntu /bin/bash 

To check docker service is start or not:
[user@cmp]# service docker status 

To start docker container:
[user@cmp]# docker start ons(name of container)

To go inside container:
[user@cmp]# docker attach ons(name of container)

To see all containers whether container start or stop:
[user@cmp]# docker ps -a

To see only running containers:
[user@cmp]# docker ps 

To stop container:
[user@cmp]# docker stop ons(name of container)

To delete container:
[user@cmp]# docker rm ons(name of container)

To stop all running containers:
[user@cmp]# docker stop $(docker ps -a -q)

To delete stop containers:
[user@cmp]# docker rm $(docker ps -a -q)

To delete all images:
[user@cmp]# docker rmi –f $(docker images –q)



Share:

0 comments

Please leave your comments...... Thanks