docker 常用命令
概念
什么是容器container
A ** container** is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings.
Container images become containers at runtime and in the case of Docker containers - images become containers when they run on Docker Engine. Available for both Linux and Windows-based applications, containerized software 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.
容器是一个标准的软件单元,它将代码及其所有依赖项打包,使应用程序能够快速可靠地从一个计算环境运行到另一个计算环境。一个 Docker 容器镜像是一个轻量级的、独立的、可执行的软件包,包括运行应用程序所需的一切: 代码、运行时间、系统工具、系统库和设置。
容器镜像在运行时变成容器,对于 Docker 容器,镜像在 Docker 引擎上运行时变成容器。可用于 Linux 和基于 windows 的应用程序,无论基础设施如何,集装箱化软件都将始终运行相同的操作。容器将软件与其环境隔离开来,并确保它能够一致地工作,尽管开发和交付准备阶段之间存在差异。
命令#
列出所有容器
docker ps
列出所有镜像
docker images
将镜像载到本地
docker pull
进入容器中
docker exec
新建一个容器并运行
docker run imagesID --name <name>
docker stop name/id
强制停止容器运行
docker kill name/id
删除容器
docker rm name/id
运行一个已存在的容器
docker start name/id
查看所有运行中的容器状态
docker stats