From Contrail version 5.X and later releases, all the services are containerized. This article lists some of the important docker commands which are useful in contrail networking.
This command is used to list the running containers. docker ps
docker ps
This command is used to access the running and exited containers. docker ps -a [or] docker ps --all
docker ps -a [or] docker ps --all
This command is used to access the running container. docker exec -it <container id> bash
docker exec -it <container id> bash
This command stops a running container docker stop <container id>
docker stop <container id>
This command kills the container by stopping its execution immediately. The difference between ‘docker kill’ and ‘docker stop’ is that ‘docker stop’ gives the container time to shutdown gracefully. When it takes too much time to get the container to stop, kill it. docker kill <container id>
docker kill <container id>
This command lists all the locally stored docker images. docker images
docker images
This command is used to delete a stopped container. docker rm <container id>
docker rm <container id>
This command renames existing container with the new name. docker rename <container_name> <new_container_name>
docker rename <container_name> <new_container_name>
This command starts a stopped container. docker start <container id>
docker start <container id>
This command is used to stop all the containers. docker stop $(docker ps -aq)
docker stop $(docker ps -aq)
This command is used to start all the containers. docker restart $(docker ps -aq)
docker restart $(docker ps -aq)
This command is used to remove all the containers. docker rm $(docker ps -aq)
docker rm $(docker ps -aq)
This command is used to remove all the images. docker rmi $(docker images -q)
docker rmi $(docker images -q)