zoukankan      html  css  js  c++  java
  • docker日常操作

    一、查看容器

    docker ps -a

    [root@localhost chaincodes]# docker ps -a
    CONTAINER ID        IMAGE                                                                                                                        COMMAND                  CREATED             STATUS                     PORTS                                        NAMES
    b39c072798d7        hl95dev-peer0.beijing.blockchain.hl95.com-mychaincode-1.0-823fbf6258db92602c3daa6638ff488933a0342e90e2abe5a7d7cc89c5161424   "/root/chaincode-jav…"   3 minutes ago       Exited (1) 2 minutes ago                                                hl95dev-peer0.beijing.blockchain.hl95.com-mychaincode-1.0
    a4a599757e3c        hyperledger/fabric-couchdb                                                                                                   "tini -- /docker-ent…"   7 days ago          Up 7 days                  4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp   couchdb_beijing_peer
    d485bf9496d7        obsidiandynamics/kafdrop                                                                                                     "/kafdrop.sh"            9 days ago          Up 9 days                  0.0.0.0:9000->9000/tcp                       kafdrop_kafdrop_1

    查看容器ID

    [root@localhost chaincodes]# docker ps -aq
    a4a599757e3c
    d485bf9496d7

    查看指定过滤字符串容器

    [root@localhost chaincodes]# docker ps -a |grep couchdb
    a4a599757e3c        hyperledger/fabric-couchdb   "tini -- /docker-ent…"   7 days ago          Up 7 days           4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp   couchdb_beijing_peer

    查看指定过滤字符串容器ID

    [root@localhost chaincodes]# docker ps -a |grep couchdb|awk '{print $1}'
    a4a599757e3c

    停止容器

    [root@localhost chaincodes]# docker stop a4a599757e3c

    删除容器

    [root@localhost chaincodes]# docker rm -f a4a599757e3c

    批量停止容器

    [root@localhost chaincodes]# docker stop $(docker ps -a|grep couchdb|awk '{print $1}')

    批量删除容器

    [root@localhost chaincodes]# docker rm -f $(docker ps -a|grep couchdb|awk '{print $1}')

    查看镜像

    [root@localhost chaincodes]# docker images

    删除指定镜像

    docker rmi $(docker images|grep hl95dev|awk '{print $3}')

    docker-compose启动

    docker-compose -f docker-compose-couch.yaml up -d

    -t:显示时间戳的日志

    -f :实时查看的日志

    --tail:查看最后指定行数的日志

    --since:查看指定日期或时间段以后的日志

    查看日期为2020-07-17以后的最后10行日志

    [root@localhost chaincodes]# docker logs -t --since="2020-07-17" --tail 10  a4a599757e3c
    2020-07-17T03:07:27.650790461Z [notice] 2020-07-17T03:07:27.650273Z nonode@nohost <0.9417.348> 8478b007b6 219.239.7.161:5984 219.239.8.14 admin GET / 200 ok 1
    2020-07-17T03:07:27.662005237Z [notice] 2020-07-17T03:07:27.661527Z nonode@nohost <0.9417.348> 4bf119395c 219.239.7.161:5984 219.239.8.14 admin GET /_session 200 ok 1
    2020-07-17T03:07:27.730500378Z [notice] 2020-07-17T03:07:27.729815Z nonode@nohost <0.9417.348> 7fb17ce50b 219.239.7.161:5984 219.239.8.14 admin GET /_all_dbs 200 ok 3
    2020-07-17T03:07:27.797086944Z [notice] 2020-07-17T03:07:27.796605Z nonode@nohost <0.9417.348> 9d95e32cf6 219.239.7.161:5984 219.239.8.14 admin GET /_replicator 200 ok 2
    2020-07-17T03:07:27.799544963Z [notice] 2020-07-17T03:07:27.799000Z nonode@nohost <0.7240.348> fbe6a4228e 219.239.7.161:5984 219.239.8.14 admin GET /_users 200 ok 2
    2020-07-17T03:07:27.800731635Z [notice] 2020-07-17T03:07:27.800281Z nonode@nohost <0.6359.348> 50ddb64e22 219.239.7.161:5984 219.239.8.14 admin GET /hl95testchannel_ 200 ok 3
    2020-07-17T03:07:27.801674739Z [notice] 2020-07-17T03:07:27.801262Z nonode@nohost <0.9465.348> bf6a52067e 219.239.7.161:5984 219.239.8.14 admin GET /hl95testchannel_lscc 200 ok 2
    2020-07-17T03:07:27.842373613Z [notice] 2020-07-17T03:07:27.841803Z nonode@nohost <0.9465.348> b9914198fc 219.239.7.161:5984 219.239.8.14 admin GET /_utils/coupon.js?tms= 404 ok 1
    2020-07-17T03:07:28.157250122Z [notice] 2020-07-17T03:07:28.156639Z nonode@nohost <0.9465.348> 45de58a0d5 219.239.7.161:5984 219.239.8.14 admin GET /_all_dbs?startkey=%22%22&endkey=%22%E9%A6%99%22&limit=30 200 ok 3
    2020-07-17T05:31:05.828652718Z [notice] 2020-07-17T05:31:05.828072Z nonode@nohost <0.20191.352> 75e78cdbed 127.0.0.1:5984 172.19.0.1 admin GET /hl95testchannel_lscc/mychaincode?attachments=true 404 ok 7
    [root@localhost chaincodes]# 

    查看最近30分钟的日志

    [root@localhost chaincodes]# docker logs -t --since 30m a4a599757e3c
    2020-07-17T05:31:05.828652718Z [notice] 2020-07-17T05:31:05.828072Z nonode@nohost <0.20191.352> 75e78cdbed 127.0.0.1:5984 172.19.0.1 admin GET /hl95testchannel_lscc/mychaincode?attachments=true 404 ok 7
    [root@localhost chaincodes]# 

    查看某个时间段以后的日志

    [root@localhost chaincodes]# docker logs -t --since="2020-07-17T12:00:00" a4a599757e3c

    查看某个时间段的日志

    [root@localhost chaincodes]# docker logs -t --since="2020-07-17T00:00:00"  --until="2020-07-17T23:00:00" a4a599757e3c

     实时查看当前最后100行日志

    [root@localhost logs]# docker logs -t -f --tail 100 a4a599757e3c
  • 相关阅读:
    idea搭建Spring Boot+Mybatis及使用教程
    CentOS 6 安装配置JDK+tomcat环境
    关于无线路由器之间的连接
    关于链表的面试问题(判断一个单链表中是否有环)
    华为机试ACM(字符组合问题)
    Activity的启动模式
    Notification状态栏显示信息
    Java注释Override、Deprecated、SuppressWarnings
    Fragment
    Service
  • 原文地址:https://www.cnblogs.com/sky-cheng/p/13329036.html
Copyright © 2011-2022 走看看