【HAVENT原創】kubernetes docker 經常使用指令

Docker 經常使用指令node

docker version

## 從 docker.io 拉取指定鏡像
#docker pull havent/node6:base
## 向 docker.io 提交鏡像
#docker push havent/node6:base

docker build -t havent/node6:base C:\Users\havent.liu\havent-node6-base
docker build -t havent/node6:bash C:\Users\havent.liu\havent-node6-bash
docker build -t havent/node6:pm2 C:\Users\havent.liu\havent-node6-pm2
docker build -t havent/node6:easy-monitor C:\Users\havent.liu\havent-node6-easy-monitor

docker run -p 8001:8000 havent/node6:base
docker run --name HH-1 -p 8001:8000 havent/node6:base
docker run -p 8002:8000 -p 8003:12333 havent/node6:easy-monitor

docker stop $(docker ps -q)
docker rm $(docker ps -aq)
docker ps -a

docker exec -it 4d434bbb7eff sh
docker exec -it 4d434bbb7eff pm2 list
docker logs 4d434bbb7eff -t
docker logs 4d434bbb7eff -t -f --tail=1000

## 容器到本地目錄的相互拷貝
docker cp 4d434bbb7eff:/app D:\
docker cp D:\app\build 4d434bbb7eff:/app
docker cp D:\app\index.js 4d434bbb7eff:/app

## 查看已存在的鏡像
#docker images

## 刪除某個已存在的鏡像
#docker rmi 鏡像ID

## 停用所有運行中的容器:
#docker stop $(docker ps -q)

## 刪除所有容器
#docker rm $(docker ps -aq)

## 查看當前啓動的容器
#docker ps

## 查看全部建立的容器
#docker ps -a

## 查看某個容器日誌
#docker logs 容器ID

## 查看某個容器的詳情信息(IP等)
#docker inspect 容器ID

## 命令行方式進入某個容器
#docker exec -it 容器ID sh

## 啓動容器
#docker start 容器ID

## 正常中止運行的容器
#docker stop 容器ID

## 強行終止運行的容器
#docker kill 容器ID

## 刪除某個運行的容器
#docker rm -f 容器ID

 

Kubernetes 經常使用指令docker

#kubectl get pods --all-namespaces | grep 鏡像名
#kubectl logs 容器名 --namespace=服務名 |grep error
#kubectl logs 容器名 --namespace=服務名 --tail=1000 -f |grep error

## 查看集羣中有多少Node
#kubectl get nodes

## 查看容器信息
#kubectl get pod 容器名 -n=服務名 -o yaml

## 跟蹤查看容器的日誌(tail -f):
#kubectl logs -f <pod-name> -n <namespace> -c <container-name>

## 進入一個活動中的容器
#kubectl exec -it 容器名 -n=app-service /bin/bash
#kubectl exec -it 容器名 --namespace=app-service /bin/bash

 

其餘可能用到網絡指令json

# 清除緩存
ipconfig /flushdns

# 獲取全部使用端口
netstat -ano

# 網頁性能測試工具
autocannon -c 100 -d 5 -p 10 -l http://127.0.0.1:7788

  -c/--connections NUM
        The number of concurrent connections to use. default: 10.
  -p/--pipelining NUM
        The number of pipelined requests to use. default: 1.
  -d/--duration SEC
        The number of seconds to run the autocannnon. default: 10.
  -a/--amount NUM
        The amount of requests to make before exiting the benchmark. If set, duration is ignored.
  -S/--socketPath
        A path to a Unix Domain Socket or a Windows Named Pipe. A URL is still required in order to send the correct Host header and path.
  -m/--method METHOD
        The http method to use. default: 'GET'.
  -t/--timeout NUM
        The number of seconds before timing out and resetting a connection. default: 10
  -T/--title TITLE
        The title to place in the results for identification.
  -b/--body BODY
        The body of the request.
  -i/--input FILE
        The body of the request.
  -H/--headers K=V
        The request headers.
  -B/--bailout NUM
        The number of failures before initiating a bailout.
  -M/--maxConnectionRequests NUM
        The max number of requests to make per connection to the server.
  -O/--maxOverallRequests NUM
        The max number of requests to make overall to the server.
  -r/--connectionRate NUM
        The max number of requests to make per second from an individual connection.
  -R/--overallRate NUM
        The max number of requests to make per second from an all connections.
        connection rate will take precedence if both are set.
        NOTE: if using rate limiting and a very large rate is entered which cannot be met,
              Autocannon will do as many requests as possible per second.
  -D/--reconnectRate NUM
        Some number of requests to make before resetting a connections connection to the
        server.
  -n/--no-progress
        Don't render the progress bar. default: false.
  -l/--latency
        Print all the latency data. default: false.
  -I/--idReplacement
        Enable replacement of [<id>] with a randomly generated ID within the request body. default: false.
  -j/--json
        Print the output as newline delimited json. This will cause the progress bar and results not to be rendered. default: false.
  -f/--forever
        Run the benchmark forever. Efficiently restarts the benchmark on completion. default: false.
  -s/--servername
        Server name for the SNI (Server Name Indication) TLS extension.
  -x/--excludeErrorStats
        Exclude error statistics (non 2xx http responses) from the final latency and bytes per second averages. default: false.
  -v/--version
        Print the version number.
  -h/--help
        Print this menu.
相關文章
相關標籤/搜索