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


    1、查看已有的镜像

    # docker images

     
    2、运行xinyar/erp-web镜像

    # docker run -d --restart=always -p 8091:8091 --name xinyar_erp_web_test xinyar/erp-web

    参数说明:

    -d 开启Daemon模式

    --restart=always在容器退出时总是重启容器(docker开机/重启)

     

    -p 8091:8091 指定端口映射,eg:

    -p hostPort:containerPort

    -p ip:hostPort:containerPort

    -p ip::containerPort

    -p hostPort:containerPort:udp

     

    --name xinyar_erp_web_test 容器识别

    xinyar/erp-web 指定镜像名称

     
    3、动态查看容器日志

    # docker logs containerName/containerId

     

    eg、

    docker logs -f xinyar_erp_web_test

    docker logs -f 0f9b05aa74cf

     
    4、关闭容器

    # docker stop containerName/containerId

    eg、

    docker stop xinyar_erp_web_test

     
    5、启动容器

    # docker start containerName/containerId

    eg、

    docker start xinyar_erp_web_test

     
    6、重启容器

    # docker restart containerName/containerId

    eg、

    docker restart xinyar_erp_web_test

     
    7、删除容器

    # docker rm –f containerName/containerId

    eg、

    docker rm -f xinyar_erp_web_test

     
    8、删除镜像

    # docker rmi -f IMAGE_ID/ REPOSITORY:TAG

    eg、docker rmi -f f104cf54406b

    docker rmi -f registry: latest

     

    若TAG为latest,则可不用写,如: docker rmi -f registry

     
    9、查看镜像列表

    # docker search images_name

     
    10、从公网拉取一个镜像

    # docker pull images_name

     
    11、查看帮助

    # docker command --help

     
    12、看容器的端口映射情况

    # docker port con_id

    eg、docker port 51d58caec77d

     
    13、查看正在运行的容器

    # docker ps

     
    14、查看所有的容器

    # docker ps -a

     
    15、进入容器

    # docker exec -it 容器ID /bin/bash

    # docker attach containerId #不推荐使用(退出容器的时候,容器会停止)

     
    16、查看docker网络

    # docker network ls

     
    17、查看容器pid

    # docker top con_name

    eg、docker top xinyar_erp_web_test

    18、强制删除镜像名称中包含“doss-api”的镜像

    docker rmi --force $(docker images | grep doss-api | awk '{print $3}')

  • 相关阅读:
    【caffe】create_mnist.sh在windows下的解决方案
    【caffe】loss function、cost function和error
    【caffe】未定义函数或变量caffe_
    【caffe】无法找到gpu/mxGPUArray.h: No such file or directory
    maven常见问题处理(3-1)修改maven 默认使用的 jdk 版本
    SpringCloud是什么?
    SpringCloud的服务网关zuul
    SpringCloud的EurekaClient : 客户端应用访问注册的微服务(有断路器场景)
    SpringBoot 概念和起步
    YML(1)什么是 YML
  • 原文地址:https://www.cnblogs.com/lcword/p/14379512.html
Copyright © 2011-2022 走看看