• docker help


    localhost == 127.0.0.1 == 本机ip

    ifconfig 或者 ip addr 查看本地宿主机的ip地址

    $ docker help
    Usage: docker [OPTIONS] COMMAND [arg...]
           docker [ --help | -v | --version ]

    A self-sufficient runtime for containers.

    Options:

      --config=~/.docker              Location of client config files
      -D, --debug                     Enable debug mode
      -H, --host=[]                   Daemon socket(s) to connect to
      -h, --help                      Print usage
      -l, --log-level=info            Set the logging level
      --tls                           Use TLS; implied by --tlsverify
      --tlscacert=~/.docker/ca.pem    Trust certs signed only by this CA
      --tlscert=~/.docker/cert.pem    Path to TLS certificate file
      --tlskey=~/.docker/key.pem      Path to TLS key file
      --tlsverify                     Use TLS and verify the remote
      -v, --version                   Print version information and quit

    Commands:

     attach    Attach to a running container 附着到正在运行的容器
        build     Build an image from a Dockerfile 从一个Dockerfile构建镜像 -t,为新镜像设置仓库和名称,标签 -f,指定一个区别于标准的Dockerfile的构建源的位置,文件可以不命名为Dockerfile 推荐使用 Dockerfile Dockerfile指令按顺序从上到下执行 Dockerfile每条指令都要是大写字母后面跟一个参数 Dockerfile每条指令都创建一个新的镜像层并对镜像进行提交
        commit    Create a new image from a container's changes 提交修改过的容器构建一个新的镜像 -m,指定提交信息 -a,作者信息 提交的是容器镜像与当前状态有差异的部分,非常轻 推荐使用commit构建镜像
        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 在正在运行的容器中执行命令 -d,在内部执行后台命令
        export    Export a container's filesystem as a tar archive
        history   Show the history of an image 显示镜像使如何被构建出来的历史
        images    List images 列出docker镜像 image xxx,只查看指定镜像名xxx的镜像 所有镜像都在/var/lib/docker/aufs下或者/var/lib/docker/devicemapper下
        import    Import the contents from a tarball to create a filesystem image
        info      Display system-wide information
        inspect   Return low-level information on a container, image or task 获取容器,镜像,任务的底层详细信息 --format,指定查看结果
        kill      Kill one or more running containers 快速停止正在运行的容器
        load      Load an image from a tar archive or STDIN
        login     Log in to a Docker registry. 登陆到Docker Cloud,需要提前注册账号和密码 个人认证信息保存在¥HOME/.docker/config.json中
        logout    Log out from a Docker registry.
        logs      Fetch the logs of a container 获取容器日志 -f,跟踪实时日志 -t,给日志加时间戳 logs --tail 10 -ft,跟踪并获取日志最后10行加时间戳的内容
        network   Manage Docker networks
        node      Manage Docker Swarm nodes
        pause     Pause all processes within one or more containers
        port      List port mappings or a specific mapping for the container 查看容器的端口映射或指定端口的映射情况
        ps        List containers 容器列表 -a,列出所有容器 -l,列出最后使用的容器 ps -n x,显示最后运行的x个容器 所有容器都在/var/lib/docker/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 a container 重新启动一个容器
        rm        Remove one or more containers 删除容器 -f强制删除正在运行的容器 rm ‘docker ps -a -q’,删除所有容器
        rmi       Remove one or more images
        run       Run a command in a new container 创建并启动一个新的容器然后运行指定命令 -i,保证容器中STDIN开启 -t,告诉容器分配一个伪tty终端 --name,为容器指定名称 -d,将容器放到后台运行 -c,指定容器中运行的命令 -g,指定容器中运行的命令 -p,Docker运行时开放哪些端口给外部宿主机 宿主机端口可以是随机端口,或指定特定端口,或特定主机的随机端口,或特定主机的特定端口,冒号分割,之前是宿主机之后是Docker容器端口,也可以指定UDP端口 -P,对外公开在Dockerfile中通过EXPOSE指令公开的所有端口,对应的宿主机端口随机选择 --restart=always,自动重启该容器 --restart=on-failure,退出代码非零自动重启 未指定具体镜像标签,则直接下载latest标签镜像
        save      Save one or more images to a tar archive (streamed to STDOUT by default)
        search    Search the Docker Hub for images 查找所有Docker Hub上的公共可用镜像
        service   Manage Docker services
        start     Start one or more stopped containers 启动一个已经停止的容器
        stats     Display a live stream of container(s) resource usage statistics 显示容器(s)的资源使用实时统计流
        stop      Stop one or more running containers 停止正在运行的容器
        swarm     Manage Docker Swarm
        tag       Tag an image into a repository
        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
        volume    Manage Docker volumes
        wait      Block until a container stops, then print its exit code

  • 相关阅读:
    POJ1741 Tree(树分治)
    codeforces713D Animals and Puzzle(二维倍增)
    codeforces713C Sonya and Problem Wihtout a Legend(dp)
    codeforces724E Goods transportation(最小割——dp)
    codeforces710E Generate a String(dp)
    codeforces Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) 题解(A-D)
    BNUOJ52317 As Easy As Possible(树上倍增)
    hihocoder1386 Pick Your Players(dp)
    常用函数
    vector总结(更新中。。。)
  • 原文地址:https://www.cnblogs.com/amdb/p/5888051.html
Copyright © 2020-2023  润新知