首页 > 其他 > 详细

docker基础操作

时间:2019-04-20 14:11:11      阅读:185      评论:0      收藏:0      [点我收藏+]

常用命令

  1. 查看版本  docker version
     1 [root@localhost ~]# docker version  ##下面为展示的内容
     2 Client:
     3 Version: 18.09.5
     4 API version: 1.39
     5 Go version: go1.10.8
     6 Git commit: e8ff056
     7 Built: Thu Apr 11 04:43:34 2018
     8 OS/Arch: linux/amd64
     9 Experimental: false
    10 
    11 Server: Docker Engine - Community
    12 Engine:
    13 Version: 18.09.5
    14 API version: 1.39 (minimum version 1.12)
    15 Go version: go1.10.8
    16 Git commit: e8ff056
    17 Built: Thu Apr 11 04:13:40 2018
    18 OS/Arch: linux/amd64
    19 Experimental: false
     
  2. 查看基本信息 docker info
     1  
     2 [root@localhost ~]# docker info
     3 Containers: 1
     4  Running: 0
     5  Paused: 0
     6  Stopped: 1
     7 Images: 1
     8 Server Version: 18.09.5
     9 Storage Driver: overlay2
    10  Backing Filesystem: xfs
    11  Supports d_type: true
    12  Native Overlay Diff: true
    13 Logging Driver: json-file
    14 Cgroup Driver: cgroupfs
    15 Plugins:
    16  Volume: local
    17  Network: bridge host macvlan null overlay
    18  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
    19 Swarm: inactive
    20 Runtimes: runc
    21 Default Runtime: runc
    22 Init Binary: docker-init
    23 containerd version: bb71b10fd8f58240ca47fbb579b9d1028eea7c84
    24 runc version: 2b18fe1d885ee5083ef9f0838fee39b62d653e30
    25 init version: fec3683
    26 Security Options:
    27  seccomp
    28   Profile: default
    29 Kernel Version: 3.10.0-693.el7.x86_64
    30 Operating System: CentOS Linux 7 (Core)
    31 OSType: linux
    32 Architecture: x86_64
    33 CPUs: 1
    34 Total Memory: 472.3MiB
    35 Name: localhost.base
    36 ID: MPTB:4OOJ:RSNX:HA4R:CGFD:XAKU:B7IL:MD4C:WQDH:ISVM:YBZ4:NEWV
    37 Docker Root Dir: /var/lib/docker
    38 Debug Mode (client): false
    39 Debug Mode (server): false
    40 Registry: https://index.docker.io/v1/
    41 Labels:
    42 Experimental: false
    43 Insecure Registries:
    44  127.0.0.0/8
    45 Registry Mirrors:
    46  https://demo.mirror.aliyuncs.com/
    47 Live Restore Enabled: false
    48 Product License: Community Engine
  3. 查看帮助命令 docker help
     1 [root@localhost ~]# docker help
     2 
     3 Usage:  docker [OPTIONS] COMMAND   #语法格式
     4 
     5 A self-sufficient runtime for containers
     6 
     7 Options:                        
     8       --config string      Location of client config files (default "/root/.docker")
     9   -D, --debug              Enable debug mode
    10   -H, --host list          Daemon socket(s) to connect to
    11   -l, --log-level string   Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
    12       --tls                Use TLS; implied by --tlsverify
    13       --tlscacert string   Trust certs signed only by this CA (default "/root/.docker/ca.pem")
    14       --tlscert string     Path to TLS certificate file (default "/root/.docker/cert.pem")
    15       --tlskey string      Path to TLS key file (default "/root/.docker/key.pem")
    16       --tlsverify          Use TLS and verify the remote
    17   -v, --version            Print version information and quit
    18 
    19 Management Commands:
    20   builder     Manage builds
    21   config      Manage Docker configs
    22   container   Manage containers
    23   engine      Manage the docker engine
    24   image       Manage images
    25   network     Manage networks
    26   node        Manage Swarm nodes
    27   plugin      Manage plugins
    28   secret      Manage Docker secrets
    29   service     Manage services
    30   stack       Manage Docker stacks
    31   swarm       Manage Swarm
    32   system      Manage Docker
    33   trust       Manage trust on Docker images
    34   volume      Manage volumes
    35 
    36 Commands:
    37   attach      Attach local standard input, output, and error streams to a running container
    38   build       Build an image from a Dockerfile
    39   commit      Create a new image from a containers changes
    40   cp          Copy files/folders between a container and the local filesystem
    41   create      Create a new container
    42   diff        Inspect changes to files or directories on a containers filesystem
    43   events      Get real time events from the server
    44   exec        Run a command in a running container
    45   export      Export a containers filesystem as a tar archive
    46   history     Show the history of an image
    47   images      List images
    48   import      Import the contents from a tarball to create a filesystem image
    49   info        Display system-wide information
    50   inspect     Return low-level information on Docker objects
    51   kill        Kill one or more running containers
    52   load        Load an image from a tar archive or STDIN
    53   login       Log in to a Docker registry
    54   logout      Log out from a Docker registry
    55   logs        Fetch the logs of a container
    56   pause       Pause all processes within one or more containers
    57   port        List port mappings or a specific mapping for the container
    58   ps          List containers            #docker ps   #查看正在运行的容器
    59   pull        Pull an image or a repository from a registry           #docker pull tomcat    #默认从仓库拉取最新镜像 相当于 docker pull tomcat:latest
    60   push        Push an image or a repository to a registry
    61   rename      Rename a container
    62   restart     Restart one or more containers
    63   rm          Remove one or more containers
    64   rmi         Remove one or more images          #docker rmi hello-world  #删除镜像默认tag为latest, 添加-f参数强制删除
    65   run         Run a command in a new container   #docker run -it --name mycentos centos:latest  #以mycentos作为名字启动一个交互式容器,并进入终端, 退出使用 1.exit 2.ctrl+p+q
    66   save        Save one or more images to a tar archive (streamed to STDOUT by default)
    67   search      Search the Docker Hub for images                                      #docker search -s 10 redis  #过滤所有结果,查找stars超过10个的redis镜像
    68   start       Start one or more stopped containers
    69   stats       Display a live stream of container(s) resource usage statistics
    70   stop        Stop one or more running containers
    71   tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
    72   top         Display the running processes of a container
    73   unpause     Unpause all processes within one or more containers
    74   update      Update configuration of one or more containers
    75   version     Show the Docker version information
    76   wait        Block until one or more containers stop, then print their exit codes
    77 
    78 Run docker COMMAND --help for more information on a command.

docker基础操作

原文:https://www.cnblogs.com/rockey-tech/p/10740744.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!