Docker Container commands in DevOps || DevOps Docker Commands || Container Commands in DevOps.

Опубликовано: 22 Март 2026
на канале: Global IThub
79
1

Docker Container commands in DevOps || DevOps Docker Commands || Container Commands in DevOps.

Docker Container Commands
-----------------------------------------------
1. To check list of running containers
docker container ls

2. To check list of Running and Stopped Containers
docker ps -a

3. To Check Detailed information about a container
docker inspect container_Name/Container_ID

4. To check logs generated by a container
docker logs container_Name/Container_ID

5. TO start a stopped containers
docker start container_Name/Container_ID

6. To Stop a running containers
docker stop container_Name/Container_ID

7. To restart a container
docker restart container_Name/Container_ID

8. To restart a container after 30 seconds
docker restart -t 30 container_Name/Container_ID

9. To remove a stopped container
docker rm container_Name/Container_ID

10. To remove a running container
docker rm -f container_Name/Container_ID

11. To stop all running containers
docker stop $(docker ps -aq)

12. To remove all stopped containers
docker rm $(docker ps -aq)

13. To remove all running and stopped containers
docker rm -f $(docker ps -aq)

14. To create a container from the image.
docker run Image_Name

Run command options:-
----------------------
-it: used for opening an interactive terminal in the container where we can fire Linux commands
-d: Runs the container as a deamon ie it runs the container in the background
--Name: Used for assigning a name to a container.
-p: To assigning port mapping
-P: To assigning automatic port mapping
-V: used for mounting volumes on a container.
-e : used for assigning environment variable.
-rm: used for removing the container on exit.
-mem: Used for allocating memory to a container.
-CPU: used for allocating a fixed amount of CPU on the container.
15. To check ports used by a container
docker port container_Name/Container_ID