Docker备忘单

Docker命令备忘单。

Docker provides the ability to package and run an application in a loosely isolated environment called a container. The isolation and security allows you to run many containers simultaneously on a given host. Containers are lightweight and contain everything needed to run the application, so you do not need to rely on what is currently installed on the host. You can easily share containers while you work, and be sure that everyone you share with gets the same container that works in the same way.

INSTALLATION

GENERAL COMMANDS

Docker Desktop is available for Mac, Linux and Windows https://docs.docker.com/desktop

View example projects that use Docker

https://github.com/docker/awesome-compose

Check out our docs for information on using Docker https://docs.docker.com

IMAGES

Docker images are a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings.

Build an Image from a Dockerfile

docker build -t <image_name> . 

Build an Image from a Dockerfile without the cache

docker build -t <image\_name> . -no-cache 

List local images

docker images 

Delete an Image

docker rmi <image\_name> 

Remove all unused images

docker image prune 

DOCKER HUB

Docker Hub is a service provided by Docker for finding and sharing container images with your team. Learn more and find images at https://hub.docker.com

Login into Docker

docker login -u <username> 

Publish an image to Docker Hub

docker push <username>/<image\_name> 

Search Hub for an image

docker search <image\_name> 

Pull an image from a Docker Hub

docker pull <image\_name> 

Start the docker daemon

docker -d 

Get help with Docker. Can also use -help on all subcommands

docker --help 

Display system-wide information

docker info 

CONTAINERS

A container is a runtime instance of a docker image. A container will always run the same, regardless of the infrastructure. Containers isolate software from its environment and ensure that it works uniformly despite differences for instance between development and staging.

Create and run a container from an image, with a custom name:

docker run --name <container\_name> <image\_name> 

Run a container with and publish a container’s port(s) to the host.

docker run -p <host\_port>:<container\_port> <image\_name> 

Run a container in the background

docker run -d <image\_name> 

Start or stop an existing container:

docker start|stop <container\_name> (or <container-id>) 

Remove a stopped container:

docker rm <container\_name> 

Open a shell inside a running container:

docker exec -it <container\_name> sh 

Fetch and follow the logs of a container:

docker logs -f <container\_name> 

To inspect a running container:

docker inspect <container\_name> (or <container\_id>) 

To list currently running containers:

docker ps 

List all docker containers (running and stopped):

docker ps --all 

View resource usage stats

docker container stats 

相关工具 (20)

chmod 命令速查表
Linux 权限变更速查表
常用正则表达式备忘单
常用正则表达式模式备忘单。
CSS选择器备忘单
CSS选择器语法备忘单。
Docker Compose 备忘单
Docker Compose 格式备忘单
Docker备忘单
Docker命令备忘单。
Docker SWARM 备忘单
Docker Swarm 模式速查表
Dockerfile 备忘单
Dockerfile 语法和构建备忘单
JQ备忘单
JQ命令备忘单
JSONPath语法备忘单
JSONPath语法备忘单
Markdown备忘单
Markdown备忘单
Nano备忘单
Nano编辑器备忘单
正则表达式备忘单
JavaScript正则表达式备忘单
Sed 备忘单
sed unix 命令速查表
XPath语法备忘单
XPath语法备忘单
Docker Compose格式转换器
在V1、2.x、3.x或CommonSpec之间转换Docker Compose文件,可扩展端口/卷语法。
Docker Compose到Docker运行转换器
将Docker Compose文件转换为docker run命令!
Docker Compose 到 .env 文件
从现有的 Docker Compose 文件中提取 .env 文件
Docker Compose到Kubernetes
Docker Compose转换为Kubernetes清单。
Docker Compose到Quadlets转换器
将Docker Compose文件内容转换为Podman Quadlets
Docker Compose验证器
根据CommonSpec模式验证Docker Compose文件。
留言区
昵称
邮箱
网址
0/1000
  • OωO
  • |´・ω・)ノ
  • ヾ(≧∇≦*)ゝ
  • (☆ω☆)
  • (╯‵□′)╯︵┴─┴
  •  ̄﹃ ̄
  • (/ω\)
  • ∠( ᐛ 」∠)_
  • (๑•̀ㅁ•́ฅ)
  • →_→
  • ୧(๑•̀⌄•́๑)૭
  • ٩(ˊᗜˋ*)و
  • (ノ°ο°)ノ
  • (´இ皿இ`)
  • ⌇●﹏●⌇
  • (ฅ´ω`ฅ)
  • (╯°A°)╯︵○○○
  • φ( ̄∇ ̄o)
  • ヾ(´・ ・`。)ノ"
  • ( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
  • (ó﹏ò。)
  • Σ(っ °Д °;)っ
  • ( ,,´・ω・)ノ"(´っω・`。)
  • ╮(╯▽╰)╭
  • o(*////▽////*)q
  • >﹏<
  • ( ๑´•ω•) "(ㆆᴗㆆ)
  • 😂
  • 😀
  • 😅
  • 😊
  • 🙂
  • 🙃
  • 😌
  • 😍
  • 😘
  • 😜
  • 😝
  • 😏
  • 😒
  • 🙄
  • 😳
  • 😡
  • 😔
  • 😫
  • 😱
  • 😭
  • 💩
  • 👻
  • 🙌
  • 🖕
  • 👍
  • 👫
  • 👬
  • 👭
  • 🌚
  • 🌝
  • 🙈
  • 💊
  • 😶
  • 🙏
  • 🍦
  • 🍉
  • 😣
  • 颜文字
  • Emoji
  • Bilibili
0 条评论
没有评论
Powered by Twikoo v1.6.44
Twikoo 评论管理
密码