InterviewSolution
| 1. |
What are the basic actions performed on the docker container? |
|
Answer» Basic actions on Docker containers are:
Following command creates the docker container with the required images. docker create --name <container-name> <image-name>
Following command helps to execute the container docker run -it -d --name <container-name> <image-name> bashMain steps involved in the run command is
Processes running inside the container is paused. Following command helps us to achieve this. docker pause <container-id/name>Container can’t be removed if in a paused state.
Unpause moves the container back to run the state. Below command helps us to do this. docker unpause <container-id/name>
If container is in a stopped state, container is started. docker start <container-id/name>
Container with all its processes is stopped with below command. docker stop <container-id/name>To stop all the running Docker containers use the below command docker stop $(docker ps -a -q)
Container ALONG with its processes are restarted docker restart <container-id/name>
A container can be killed with below command docker kill <container-id/name>
The entire container is DISCARDED. It is preferred to do this when the container is in a stopped state rather than do it forcefully. docker rm <container-id/name> |
|