Docker command

Docker ps -a Lists containers (and tells you which images they are spun from)
Docker images Lists images
Docker rm Removes a container
Docker rmi Removes an image (will fail if there is a running instance of that image i.e. container)
1 Download a Docker Image>>>>>..
To search for a Docker image, Ubuntu for instance, issue the following command:
[root@pc1 ~] docker search ubuntu
2 download docker image>>>>>>>>>>>>.
[root@pc1 ~] docker pull ubuntu
3 docker images>>>>>>…
[root@pc1 ~] docker images
4 Remove Docker Images>>>>>…..
[root@pc1 ~] docker rmi ubuntu
5 create CONTAINER>>>>>>>>>>…
[root@pc1 ~] docker run centos
6 Check the continer>>>>>>>>>>
docker ps -as (command show all CONTAINER)
sudo docker run -t -i centos /bin/bash (login container)
7 Remove Docker Containers>>>>>>>>>
docker stop 0a7f942af066
docker rm 0a7f942af066 remove container(docker rm CONTAINER ID)
[root@pc1 ~] docker ps -as
8 Stop & Remove All Docker Containers>>>>>>>>>>>>>>>>>>>>
Stop All Containers
[root@pc1 ~] docker stop $(docker ps -a -q)
Remove All Containers
[root@pc1 ~] docker rm $(docker ps -a -q)

1 Comment

  1. iptables -t nat -D DOCKER -p tcp –dport 80 -j DNAT –to-destination 172.17.0.2:80
    iptables -t nat -A DOCKER -p tcp –dport 20 -j DNAT –to-destination 172.17.0.1:20
    iptables -t nat -A DOCKER -p tcp –dport 21 -j DNAT –to-destination 172.17.0.1:21

Leave a Reply

Your email address will not be published.


*