博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【HAVENT原创】kubernetes docker 常用指令
阅读量:6459 次
发布时间:2019-06-23

本文共 4534 字,大约阅读时间需要 15 分钟。

  hot3.png

Docker 常用指令

docker version## 从 docker.io 拉取指定镜像#docker pull havent/node6:base## 向 docker.io 提交镜像#docker push havent/node6:basedocker build -t havent/node6:base C:\Users\havent.liu\havent-node6-basedocker build -t havent/node6:bash C:\Users\havent.liu\havent-node6-bashdocker build -t havent/node6:pm2 C:\Users\havent.liu\havent-node6-pm2docker build -t havent/node6:easy-monitor C:\Users\havent.liu\havent-node6-easy-monitordocker run -p 8001:8000 havent/node6:basedocker run --name HH-1 -p 8001:8000 havent/node6:basedocker run -p 8002:8000 -p 8003:12333 havent/node6:easy-monitordocker stop $(docker ps -q)docker rm $(docker ps -aq)docker ps -adocker exec -it 4d434bbb7eff shdocker exec -it 4d434bbb7eff pm2 listdocker logs 4d434bbb7eff -tdocker logs 4d434bbb7eff -t -f --tail=1000## 容器到本地目录的相互拷贝docker cp 4d434bbb7eff:/app D:\docker cp D:\app\build 4d434bbb7eff:/appdocker 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 
-n
-c
## 进入一个活动中的容器#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 [
] 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.

 

转载于:https://my.oschina.net/u/943746/blog/2872100

你可能感兴趣的文章
移动铁通宽带上网设置教程
查看>>
Python算法(含源代码下载)
查看>>
利用Windows自带的Certutil查看文件MD5
查看>>
通过原生js添加div和css
查看>>
简单的导出表格和将表格下载到桌面上。
查看>>
《ArcGIS Engine+C#实例开发教程》第一讲桌面GIS应用程序框架的建立
查看>>
JAVA - 大数类详解
查看>>
查询指定名称的文件
查看>>
Python 嵌套列表解析
查看>>
[GXOI/GZOI2019]旧词——树链剖分+线段树
查看>>
anroid 广播
查看>>
AJAX POST&跨域 解决方案 - CORS
查看>>
关于最小生成树中的kruskal算法中判断两个点是否在同一个连通分量的方法总结...
查看>>
开篇,博客的申请理由
查看>>
Servlet 技术全总结 (已完成,不定期增加内容)
查看>>
[JSOI2008]星球大战starwar BZOJ1015
查看>>
CountDownLatch与thread-join()的区别
查看>>
centos 7 部署LDAP服务
查看>>
揭秘马云帝国内幕:马云的野心有多大
查看>>
iOS项目分层
查看>>