Docker 常用指令
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 常用指令
#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
其他可能用到网络指令
# 清除缓存
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.