【docker】docker帮助命令详细了解

1.查看帮助命令 

[root@oracle1 soft]# docker container

Usage:  docker container COMMAND

Manage containers

Commands:
  attach      Attach local standard input, output, and error streams to a running container
  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 to files or directories on a container's filesystem
  exec        Run a command in a running container
  export      Export a container's filesystem as a tar archive
  inspect     Display detailed information on one or more containers
  kill        Kill one or more running containers
  logs        Fetch the logs of a container
  ls          List containers
  pause       Pause all processes within one or more containers
  port        List port mappings or a specific mapping for the container
  prune       Remove all stopped containers
  rename      Rename a container
  restart     Restart one or more containers
  rm          Remove one or more containers
  run         Run a command in a new container
  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
  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
  wait        Block until one or more containers stop, then print their exit codes

Run 'docker container COMMAND --help' for more information on a command.

2.命令详解

docker command
[root@localhost harbor]# docker container
Usage: docker container COMMAND
Manage containers
Commands:
attach 进入容器,退出会使得容器宕机。(不推荐使用)
commit 以一个运行中的容器为基础镜像创建一个新镜像
cp 在容器和本地文件之间拷贝文件或文件
create 创建一个新的容器
diff 查看一个容器的文件或目录的变化
exec 在一个运行中的容器上执行一个命令
export 以一个tar 包的形式导出一个容器的文件系统
inspect 显示一个或者多个容器的详情
kill 杀掉一个或多个运行中的容器
logs 获取某个容器的日志
ls 列出容器
pause 暂停一个或多个容器的所有进程
port 列出容器的端口映射或一个特定的映射
prune 删除所有停止的容器
rename 重命名一个容器
restart 重启一个或多个容器
rm 删除一个或多个容器
run 在一个新容器中执行一个命令
start 启动一个或多个容器
stats 展示一个容器的资源使用情况
stop 停止一个或多个容器
top 展示一个容器正在运行的进程
unpause 暂停一个或多个容器的所有进程
update 更新一个或多个容器的配置
wait 锁定一个或多个容器,然后打印出他们的退出码

--创建容器常用命令选项
-i 交互式
-t 分配一个伪终端,是为了让容器启动后有一个前台进程,因为任何一个后台进程都需要一个前台进程才能跑起来。
-d 容器在后台运行
-e 设置环境变量
-p 发布容器端口到主机
-P 大P 后面不用接端口,是把容器EXPOSE 的端口到宿主机的随机端口,EXPOSE 是Dockerfile里面定义的
-h 容器主机名,默认是一个随机的字符串
-ip 指定容器IP,只能用于自定义网络
-v 绑定挂载一个卷
--name 容器的名称,默认是一个随机字符串
-network 连接容器到一个网络,比如我们自定义一个bridege
-mount 将宿主机的数据挂在到容器
-restart always 容器退出时,会不断的尝试重启

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值