User Tools

Site Tools


docker:run-stop-containers

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
docker:run-stop-containers [2024/02/19 23:20] – ↷ Page name changed from docker:run-stop-an-image to docker:run-stop-containers odeftadocker:run-stop-containers [2024/02/23 19:40] (current) odefta
Line 1: Line 1:
-====== Run a docker image ======+======  Display running docker containers ====== 
 + 
 +<code> 
 +docker ps 
 +</code> 
 +Output: 
 +<code> 
 +e26c2dcdc6a0   ee8449491514                                                                "/agentk_linux_amd64…"   41 minutes ago   Up 41 minutes                             k8s_gitlab-agent_odefta1-gitlab-agent-v2-6b8794f498-k62hm_gitlab-agent-odefta1_9f56a2c4-d4fb-4cba-9455-a84eadd25c18_5 
 +b8a3da1af510   cbb01a7bd410                                                                "/coredns -conf /etc…"   41 minutes ago   Up 41 minutes                             k8s_coredns_coredns-76f75df574-6w59t_kube-system_28ba864d-d233-4988-a722-43cc3047da85_6 
 +32bdc9aabb3f   43c6c10396b8                                                                "/usr/local/bin/kube…"   41 minutes ago   Up 41 minutes                             k8s_kube-proxy_kube-proxy-6mwkp_kube-system_3f8f06c3-164e-4685-bce9-17ee990f1eca_6 
 +e319f3296383   registry.k8s.io/pause:3.9                                                   "/pause"                 41 minutes ago   Up 41 minutes                             k8s_POD_vpnkit-controller_kube-system_5060ecc9-2d01-4f2c-bd51-984045dbf482_6 
 +42b90dc323ee   registry.k8s.io/pause:3.9                                                   "/pause"                 41 minutes ago   Up 41 minutes                             k8s_POD_coredns-76f75df574-6w59t_kube-system_28ba864d-d233-4988-a722-43cc3047da85_6 
 +</code> 
 + 
 +====== Display all docker containers ====== 
 + 
 +<code> 
 +docker ps -a 
 +</code> 
 + 
 +====== Connect to an existing running container to execute commands ====== 
 + 
 +-it accepts container id or name 
 +<code> 
 +docker exec -it b1faf04f660b bash 
 +</code> 
 + 
 +====== Run a docker container ======
  
 <code> <code>
Line 6: Line 33:
 Hello World Hello World
  
-===== Run an image and connect to shell =====+===== Run a container and connect to shell =====
  
 To connect to the image shell and interact (i) with terminal (t), run: To connect to the image shell and interact (i) with terminal (t), run:
Line 25: Line 52:
 If no registry is specified, the docker command will search in Docker Hub (https://registry.hub.docker.com/v2/) If no registry is specified, the docker command will search in Docker Hub (https://registry.hub.docker.com/v2/)
 </note> </note>
- 
-===== Display running docker containers ===== 
- 
-<code> 
-docker ps 
-</code> 
-Output: 
-<code> 
-e26c2dcdc6a0   ee8449491514                                                                "/agentk_linux_amd64…"   41 minutes ago   Up 41 minutes                             k8s_gitlab-agent_odefta1-gitlab-agent-v2-6b8794f498-k62hm_gitlab-agent-odefta1_9f56a2c4-d4fb-4cba-9455-a84eadd25c18_5 
-b8a3da1af510   cbb01a7bd410                                                                "/coredns -conf /etc…"   41 minutes ago   Up 41 minutes                             k8s_coredns_coredns-76f75df574-6w59t_kube-system_28ba864d-d233-4988-a722-43cc3047da85_6 
-32bdc9aabb3f   43c6c10396b8                                                                "/usr/local/bin/kube…"   41 minutes ago   Up 41 minutes                             k8s_kube-proxy_kube-proxy-6mwkp_kube-system_3f8f06c3-164e-4685-bce9-17ee990f1eca_6 
-e319f3296383   registry.k8s.io/pause:3.9                                                   "/pause"                 41 minutes ago   Up 41 minutes                             k8s_POD_vpnkit-controller_kube-system_5060ecc9-2d01-4f2c-bd51-984045dbf482_6 
-42b90dc323ee   registry.k8s.io/pause:3.9                                                   "/pause"                 41 minutes ago   Up 41 minutes                             k8s_POD_coredns-76f75df574-6w59t_kube-system_28ba864d-d233-4988-a722-43cc3047da85_6 
-</code> 
- 
-===== Display all docker containers ===== 
- 
-<code> 
-docker ps -a 
-</code> 
  
 ====== Stop a running docker container ====== ====== Stop a running docker container ======
docker/run-stop-containers.1708377604.txt.gz · Last modified: 2024/02/19 23:20 by odefta