欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 房产 > 家装 > 03.Docker 命令帮助

03.Docker 命令帮助

2025/2/22 2:04:12 来源:https://blog.csdn.net/weixin_56408536/article/details/145724558  浏览:    关键词:03.Docker 命令帮助

Docker 命令帮助

  • Docker 命令帮助
    • 1. docker 命令帮助
    • 2. docker 优化

Docker 命令帮助

docker 命令是最常使用的 docker 客户端命令,其后面可以加不同的参数以实现不同的功能。

1. docker 命令帮助

官方文档:https://docs.docker.com/reference/cli/docker/

docker [OPTIONS] COMMANDCOMMAND 分为:
Management Commands  # 指定管理的资源对象类型,较新的命令用法,将命令按资源类型进行分类,方便使用
Commands             # 对不同资源操作的命令不分类,使用容易产生混乱

docker 命令有很多子命令,可以用下面方法查看帮助

#docker 命令帮助
man docker 
docker
docker  --help#docker 子命令帮助
man docker-COMMAND
docker COMMAND --help
[root@Ubuntu2204 ~]#docker --help Usage:  docker [OPTIONS] COMMANDA self-sufficient runtime for containersOptions:--config string      Location of client config files (default "/root/.docker")-c, --context string     Name of the context to use to connect to the daemon (overridesDOCKER_HOST env var and default context set with "docker context use")-D, --debug              Enable debug mode-H, --host list          Daemon socket(s) to connect to-l, --log-level string   Set the logging level ("debug"|"info"|"warn"|"error"|"fatal")(default "info")--tls                Use TLS; implied by --tlsverify--tlscacert string   Trust certs signed only by this CA (default "/root/.docker/ca.pem")--tlscert string     Path to TLS certificate file (default "/root/.docker/cert.pem")--tlskey string      Path to TLS key file (default "/root/.docker/key.pem")--tlsverify          Use TLS and verify the remote-v, --version            Print version information and quitManagement Commands:app*        Docker App (Docker Inc., v0.9.1-beta3)builder     Manage buildsbuildx*     Docker Buildx (Docker Inc., v0.10.4-docker)config      Manage Docker configscontainer   Manage containerscontext     Manage contextsimage       Manage imagesmanifest    Manage Docker image manifests and manifest listsnetwork     Manage networksnode        Manage Swarm nodesplugin      Manage pluginssecret      Manage Docker secretsservice     Manage servicesstack       Manage Docker stacksswarm       Manage Swarmsystem      Manage Dockertrust       Manage trust on Docker imagesvolume      Manage volumesCommands:attach      Attach local standard input, output, and error streams to a running containerbuild       Build an image from a Dockerfilecommit      Create a new image from a container's changescp          Copy files/folders between a container and the local filesystemcreate      Create a new containerdiff        Inspect changes to files or directories on a container's filesystemevents      Get real time events from the serverexec        Run a command in a running containerexport      Export a container's filesystem as a tar archivehistory     Show the history of an imageimages      List imagesimport      Import the contents from a tarball to create a filesystem imageinfo        Display system-wide informationinspect     Return low-level information on Docker objectskill        Kill one or more running containersload        Load an image from a tar archive or STDINlogin       Log in to a Docker registrylogout      Log out from a Docker registrylogs        Fetch the logs of a containerpause       Pause all processes within one or more containersport        List port mappings or a specific mapping for the containerps          List containerspull        Pull an image or a repository from a registrypush        Push an image or a repository to a registryrename      Rename a containerrestart     Restart one or more containersrm          Remove one or more containersrmi         Remove one or more imagesrun         Run a command in a new containersave        Save one or more images to a tar archive (streamed to STDOUT by default)search      Search the Docker Hub for imagesstart       Start one or more stopped containersstats       Display a live stream of container(s) resource usage statisticsstop        Stop one or more running containerstag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGEtop         Display the running processes of a containerunpause     Unpause all processes within one or more containersupdate      Update configuration of one or more containersversion     Show the Docker version informationwait        Block until one or more containers stop, then print their exit codes

查看 docker 版本

[root@Ubuntu2204 ~]#docker version

查看 docker 详解信息

[root@Ubuntu2204 ~]#docker info

查看 docker0 网卡

在 docker 安装启动之后,默认会生成一个名称为 docker0 的网卡并且默认 IP 地址为 172.17.0.1 的网卡

[root@Ubuntu2204 ~]#ip a

2. docker 优化

 [root@Ubuntu2204 ~]#vim /etc/docker/daemon.json {"registry-mirrors": ["https://docker.1ms.run","https://docker.m.daocloud.io"],"insecure-registries": ["harbor.org"],"exec-opts": ["native.cgroupdriver=systemd"],"graph": "/data/docker","max-concurrent-downloads": 10,"max-concurrent-uploads": 5,"log-opts": {"max-size": "300m","max-file": "2"},"live-restore": true
}[root@Ubuntu2204 ~]#systemctl daemon-reload [root@Ubuntu2204 ~]#systemctl restart docker

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词