-
docker version
显示当前客户端和服务端的版本信息
-
docker info
显示容器,镜像等的数量,以及宿主机的一些信息
-
docker --help
attach Attach to a running container
build Build an image from a Dockerfile
commit Create a new image from a container’s changes
cp Copy files/folders between a container and the local filesystem
create Create a new container
diff Inspect changes on a container’s filesystem
events Get real time events from the server
exec Run a command in a running container
export Export a container’s filesystem as a tar archive
history Show the history of an image
images List images
import Import the contents from a tarball to create a filesystem image
info Display system-wide information
inspect Return low-level information on Docker objects
kill Kill one or more running containers
load Load an image from a tar archive or STDIN
login Log in to a Docker registry
logout Log out from a Docker registry
logs Fetch the logs of a container
pause Pause all processes within one or more containers
port List port mappings or a specific mapping for the container
ps List containers
pull Pull an image or a repository from a registry
push Push an image or a repository to a registry
rename Rename a container
restart Restart one or more containers
rm Remove one or more containers
rmi Remove one or more images
run Run a command in a new container
save Save one or more images to a tar archive (streamed to STDOUT by default)
search Search the Docker Hub for images
start Start one or more stopped containers
stats Display a live stream of container(s) resource usage statistics
stop Stop one or more running containers
tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
top Display the running processes of a container
unpause Unpause all processes within one or more containers
update Update configuration of one or more containers
version Show the Docker version information
wait Block until one or more containers stop, then print their exit codes -
docker images
-a 列出本地所有镜像
-q 只列出镜像id
–digests 列出摘要
–no-trunc 显示完整信息
-
docker search
查找指定的镜像
-s [数量] 只显示点赞数超过指定数量的镜像,已被废弃,建议使用–filter=starts=数量替代
–no-trunc 不省略介绍信息
-
docker pull
从仓库拉取某个镜像
eg:docker pull tomcat 等价于 docker pull tomcat:latest
-
docker rmi
删除某个镜像
删除时需要停止并且删除依赖于此镜像的容器
-f 参数 强制删除。
eg:
删除一个:docker rmi -f hello-world
删除多个:docker rmi -f hello-world nginx
删除全部:docker rmi -f $(docker images -qa)
-
docker run [opt] image [command] [arg]
创建并启动一个容器
-
docker ps
列出正在运行的容器
-l 上一个容器
-n 上面若干个容器
-a 所有的,包括已经停止的
-q 只显示容器编号
-
exit
在交互模式中退出容器, 容器停止
-
ctrl+p+q
在交互模式中退出容器, 容器停止
-
docker start
启动一个容器,根据id或者名字
-
docker restart
重启一个容器,根据id或者名字
-
docker stop
停止一个容器, 根据id或者名字
-
docker kill
强制停止一个容器, 根据id或者名字
-
docker rm
删除一个容器, 根据id或者名字
-f 强制删除
docker rm $(docker ps -aq)
docker rm -f $(docker ps -aq)
-
docker top
查看docker容器的进程
-
docker logs
查看docker的log
-t 加入时间戳
-f 持续输出
–tail 查看最后几行
-
docker inspect
显示容器内部细节
-
docker attach
进入某个容器的交互界面
eg :docker attach 64e8705a29d4
-
docker exec
docker exec -t 64e8705a29d4 ls -l /tmp
直接执行命令,并把结果返回宿主机
Doceker常用命令
最新推荐文章于 2024-05-22 23:58:59 发布