docker基本命令笔记第一册

1.docker --help

当你忘记一些命令的时候可以用这个指令来得到帮助

Management Commands:
  builder     Manage builds
  config      Manage Docker configs
  container   Manage containers
  context     Manage contexts
  engine      Manage the docker engine
  image       Manage images
  network     Manage networks
  node        Manage Swarm nodes
  plugin      Manage plugins
  secret      Manage Docker secrets
  service     Manage services
  stack       Manage Docker stacks
  swarm       Manage Swarm
  system      Manage Docker
  trust       Manage trust on Docker images
  volume      Manage volumes

Commands:
  attach      Attach local standard input, output, and error streams 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 to files or directories 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

2.docker run xxx

这是启动一个容器的指令,xxx为容器的名字
如果本地docker没有此容器,则会先去仓库拉取镜像,仓库若是没有该镜像则报错

-it:例如docker run - it centos /bin/bash ,即为在当前终端以bash运行容器。
-d:则在后台运行容器
-c:运行容器并给她写入shell脚本

3.docker search xxx

从docker仓库寻找镜像

--filter:使用过滤器过滤一些查找信息
例如docker search centos --filter=STARS=1000
就是寻找stars 一千+的镜像 

4.docker pull xxx

从docker仓库拉取镜像

5.docker ps

查看正在运行的容器

-a:查看所有的容器,包括停止的
-p:查看所有的容器的ports

6.docker images

查看所有的镜像

--filter:使用过滤器过滤一些查找信息
-a:查看所有的镜像,包括停止的
-p:查看所有的镜像的ports

7.docker start/restart/stop/kill xxx

分别为,开启一个容器,重启一个容器,关闭一个容器,强制杀死一个容器

8.docker exec/attach xxx

分别为在新终端进入容器,和在本终端进入容器

9.docker rm/rmi

分别为删除,和删除一个镜像

-f 删除所有 
#事例 删除所有容器
docker rm -f $(docker ps -aq)

10 docker cp xxx:/容器路径 /宿主机路径

从容器中复制文件到宿主机中。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值