Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the operating methods of Docker

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "what are the operating methods of Docker". In the daily operation, I believe that many people have doubts about the operating methods of Docker. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "what are the operating methods of Docker?" Next, please follow the editor to study!

Operation 1, docker top

This command is used to view the process information in a container. For example, if you want to see how many nginx processes are in a nginx container, you can do this.

➜~ docker top 3b307a09d20dUID PID PPID C STIME TTY TIME CMDroot 8057870 Jul13? 00:00:00 nginx: master process nginx-g daemon off Systemd+ 941 8050 Jul13? 00:03:18 nginx: worker process2, docker load & & docker save

I usually use these two commands to download and package K8s images, because you know that the Internet speed in China is not as fast as in foreign countries.

Docker save can save an image to a tar file, and you can do this

Docker save registry:2.7.1 > registry-2.7.1.tar

At the same time, docker load can import images from tar files into docker.

Docker load < registry-2.7.1.tar3, docker search

This command can help you easily search for images in dockerhub on the command line, such as

➜~ docker search nginxNAME DESCRIPTION STARS OFFICIAL AUTOMATEDnginx Official build of Nginx. 13519 [OK] jwilder/nginx-proxy Automated Nginx reverse proxy for docker con... 1846 [OK] richarvey/nginx-php-fpm Container running Nginx + PHP-FPM capable of … [OK] linuxserver/nginx An Nginx container, brought to you by LinuxS... 123bitnami/nginx Bitnami nginx Docker Image 87 [OK] tiangolo/nginx-rtmp Docker image with Nginx using the nginx-rtmp... [OK] jc21/nginx-proxy-manager Docker container for managing Nginx proxy ho... 73alfg/nginx-rtmp NGINX, nginx-rtmp-module and FFmpeg from sou... 71 [OK] nginxdemos/hello NGINX webserver that serves a simple page co... 57 [OK] jlesage/nginx-proxy-manager Docker container for Nginx Proxy Manager 53 [OK] nginx/nginx-ingress NGINX Ingress Controller for Kubernetes 37privatebin/nginx-fpm-alpine PrivateBin running on an Nginx, php-fpm & Al... 31 [OK] schmunk42/nginx-redirect A very simple container to redirect HTTP tra... 18 [OK] nginxinc/nginx-unprivileged Unprivileged NGINX Dockerfiles 16nginx/nginx-prometheus-exporter NGINX Prometheus Exporter 14centos/nginx-112-centos7 Platform for running nginx 1.12 or building... 13centos/nginx-18-centos7 Platform for running nginx 1.8 or building n... 13raulr/nginx-wordpress Nginx front-end for the official wordpress:f... 13 [OK] sophos/nginx-vts-exporter Simple server that scrapes Nginx vts stats a... 7 [OK] mailu/nginx Mailu nginx frontend 7 [OK] bitnami/nginx-ingress-controller Bitnami Docker Image for NGINX Ingress Contr... [OK] bitwarden/nginx The Bitwarden nginx web server acting as ar... 6flashspys/nginx-static Super Lightweight Nginx Image 6 [OK] wodby/nginx Generic nginx 1 [OK] ansibleplaybookbundle/nginx-apb An APB to deploy NGINX 1 [OK]

Of course, this function may not work very well in China.

4 、 docker events

This command can help you get all kinds of event information about docker in real time, such as creating a container.

➜~ docker events2020-07-28T21:28:46.000403018+08:00 image load sha256:432bf69f0427b52cad10897342eaf23521b7d973566354118e9a59c4d31b5fae (name=sha256:432bf69f0427b52cad10897342eaf23521b7d973566354118e9a59c4d31b5fae) 5, docker update

When you docker run and find that there are some parameters that are not in the state you want, such as the nginx container cpu or memory is too small, you can use docker update to modify these parameters.

Docker update nginx-cpus 26, docker history

You can use this command when you modify an image but forget the modify command for each layer, or when you want to see how an image is built, such as

➜~ docker history traefik:v2.1.6IMAGE CREATED CREATED BY SIZE COMMENT5212a87ddaba 5 months ago / bin/sh-c # (nop) LABEL org.opencontainers. 0B 5 months ago / bin/sh-c # (nop) CMD ["traefik"] 0B 5 months ago / bin/sh-c # (nop) ENTRYPOINT ["/ entrypoint. 0B 5 months ago / bin/sh-c # (nop) EXPOSE 800B 5 months ago / bin/sh-c # (nop) COPY file:59a219a1fb7a9dc8 … 419B 5 months ago / bin/sh-c set-ex; apkArch= "$(apk-- print- …" 52.9MB 5 months ago / bin/sh-c apk-- no-cache add ca-certificate... 1.85MB 6 months ago / bin/sh-c # (nop) CMD ["/ bin/sh"] 0B 6 months ago / bin/sh-c # (nop) ADD file:a1906f14a4e217a49 … 4.81MB7 、 docker wait

This command can check the exit status of the container, such as

➜~ docker wait 7f7f0522a7d00

So you can know whether the container exits normally or abnormally.

8. Docker pause & & docker unpause

You can use this command when you run a container but want to pause it.

9 、 docker diff

You can use this command when you run a container but you don't know which files have been modified in the container, such as

➜~ docker diff 38c59255bf6eC / etcA / etc/localtimeC / varC / var/libA / var/lib/registry10, docker stats

This is the docker built-in monitoring command, which you can use when you want to see how all the containers under the current host are taking up memory and cpu.

At this point, the study of "what are the operating methods of Docker" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report