zoukankan      html  css  js  c++  java
  • docker常用命令

    1、docker search

    Usage:    docker search [OPTIONS] TERM
    Search the Docker Hub for images(从docker仓库查询镜像信息)

    2、docker pull

    Usage:    docker pull [OPTIONS] NAME[:TAG|@DIGEST]
    Pull an image or a repository from a registry(从仓库拉去镜像)

    3、docker images

    Usage:    docker images [OPTIONS] [REPOSITORY[:TAG]]
    List images(列出本地镜像)

    4、docker run/docker create

    Usage:    docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
    Run a command in a new container(运行一个新的容器)

    -i, --interactive                 Keep STDIN open even if not attached
    -t, --tty                         Allocate a pseudo-TTY
    -d, --detach                      Run container in background and print container ID
    -p, --publish value               Publish a container's port(s) to the host (default [])
    -P, --publish-all                 Publish all exposed ports to random ports
         --name string                 Assign a name to the container
         --link value                  Add link to another container (default [])

    Usage:    docker create [OPTIONS] IMAGE [COMMAND] [ARG...]
    Create a new container(创建一个新的容器,但不启动它,用法同docker run)

    5、docker ps

    Usage:    docker ps [OPTIONS]
    List containers(列出本地容器)

    -a, --all             Show all containers (default shows just running)

    6、docker exec

    Usage:    docker exec [OPTIONS] CONTAINER COMMAND [ARG...]
    Run a command in a running container(在一个运行的容器中运行命令)

      -d, --detach         Detached mode: run command in the background
       -i, --interactive    Keep STDIN open even if not attached
       -t, --tty            Allocate a pseudo-TTY

    7、docker stop|start|restart

    Usage:    docker stop [OPTIONS] CONTAINER [CONTAINER...]
    Stop one or more running containers

    Usage:    docker start [OPTIONS] CONTAINER [CONTAINER...]
    Start one or more stopped containers

    Usage:    docker restart [OPTIONS] CONTAINER [CONTAINER...]
    Restart a container

    8、docker kill

    Usage:    docker kill [OPTIONS] CONTAINER [CONTAINER...]
    Kill one or more running containers

    9、docker rm

    Usage:    docker rm [OPTIONS] CONTAINER [CONTAINER...]
    Remove one or more containers(删除一个或多个容器)

    -f, --force     Force the removal of a running container (uses SIGKILL)

    10、docker rmi

    Usage:    docker rmi [OPTIONS] IMAGE [IMAGE...]
    Remove one or more images(删除一个或多个镜像)

    -f, --force      Force removal of the image

    11、docker commit

    Usage:    docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
    Create a new image from a container's changes

    注意:docker commit不能保存volumn中变化的数据(docker mysql数据持久化会遇到类似的问题)。

    12、docker diff

    Usage:    docker diff CONTAINER
    Inspect changes on a container's filesystem

    13、docker cp

    Usage:    docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|-
             docker cp [OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH
    Copy files/folders between a container and the local filesystem(在容器和本地文件系统中拷贝文件或目录)

    14、docker port

    Usage:    docker port CONTAINER [PRIVATE_PORT[/PROTO]]
    List port mappings or a specific mapping for the container

    15、docker rename

    Usage:    docker rename CONTAINER NEW_NAME
    Rename a container(容器重命名)

  • 相关阅读:
    QR code 乱谈(一)
    用JAVA实现数字水印(可见)
    ctf总结
    Unix/Linux常用命令
    C语言概述
    C语言发发展历史
    为什么要学习C语言
    计算机应用领域
    计算机发展趋势
    如何学习计算机
  • 原文地址:https://www.cnblogs.com/wcwen1990/p/8459620.html
Copyright © 2011-2022 走看看