美文网首页
docker命令整理

docker命令整理

作者: 冷风袭水 | 来源:发表于2017-03-09 10:44 被阅读0次

    docker整理

    1. 查看docker信息(version、info)
    # 查看docker版本  
    $docker version  
    # 显示docker系统的信息  
    $docker info  
    
    2. 对image的操作(search、pull、images、rmi、history)
    # 检索image  
    $docker search image_name  
    # 下载image  
    $docker pull image_name  
    # 列出镜像列表; -a, --all=false Show all images; --no-trunc=false Don't truncate output; -q, --quiet=false Only show numeric IDs  
    $docker images  
    # 删除一个或者多个镜像; -f, --force=false Force; --no-prune=false Do not delete untagged parents  
    $docker rmi image_name  
    # 显示一个镜像的历史; --no-trunc=false Don't truncate output; -q, --quiet=false Only show numeric IDs  
    $docker history image_name  
    
    3. 启动容器(run)
    # 在容器中运行"echo"命令,输出"hello word"  
    $docker run image_name echo "hello word"  
    # 交互式进入容器中  
    $docker run -i -t image_name /bin/bash  
    # 在容器中安装新的程序  
    $docker run image_name apt-get install -y app_name  
    
    4. 查看容器(ps)
    # 列出当前所有正在运行的container  
    $docker ps  
    # 列出所有的container  
    $docker ps -a  
    # 列出最近一次启动的container  
    $docker ps -l  
    

    5. 保存对容器的修改(commit)

    # 保存对容器的修改; -a, --author="" Author; -m, --message="" Commit message  
    $docker commit ID new_image_name  
    

    相关文章

      网友评论

          本文标题:docker命令整理

          本文链接:https://www.haomeiwen.com/subject/mxrwgttx.html