docker故障排查

问题1:安装docker-ce-19.03.11-3.el7 ,但安装了Client: Docker Engine - Community 20.10.7?

原因分析:指定安装docker-ce-server时并未指定client版本,默认安装最新版本,但不影响使用。

解决方法:指定版本安装即可。

yum -y install docker-ce-19.03.11-3.el7 docker-ce-cli-19.03.11-3.el7 containerd.io

 

问题2:拉取公网镜像失败?

[root@localhost ~]# docker search alpine
Error response from daemon: Get https://index.docker.io/v1/search?q=alpine&n=25: x509: certificate has expired or is not yet valid
[root@localhost ~]# date
Wed Oct 28 20:25:32 CST 2020

原因分析:docker证书过期。

解决方法:更新系统时间,与外网时钟一致即可。

yum -y install npdate && ntpdate cn.pool.ntp.org

 

 问题3:拉取公网镜像出现卡顿现象?

原因分析:终端、网络原因。

解决方法:更换终端下载即可。

 

 

 

问题2:image生成失败?

[root@controller hello]# docker build -t chalon/hello-world:v1 ./
Sending build context to Docker daemon 864.8kB
Error response from daemon: Dockerfile parse error line 1: FROM requires either one or three arguments

原因分析:dockerfile存在问题;

解决方法:取消注释即可。

 

问题3:docker私有仓库不能上传image?

[root@controller ~]# docker push 192.168.66.10:5000/alpine
The push refers to repository [192.168.66.10:5000/alpine]
72e830a4dff5: Preparing
error parsing HTTP 404 response body: no error details found in HTTP response body: "{\"error\": {\"message\": \"The resource could not be found.\", \"code\": 404, \"title\": \"Not Found\"}}"

原因分析:排查服务端口正常;

解决方法:暂无。

 

问题4:容器映射端口失败?

[root@controller ~]# docker run -d --network my-bridge -p 80:8000 --name nginx-1 nginx
cfa68bba048f66f505cb6db6ab5728d7745bf1511b49ff0e3e7893a3a8920f09
docker: Error response from daemon: driver failed programming external connectivity on endpoint nginx-1 (faf91e72926b3b4a51372eb754d8d0b0c8e4d65b2cd64d51998056d67f748965): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use.

[root@controller ~]# docker run -d --network my-bridge -p 8000:80 --name nginx-1 nginx
915090a8acc0ae5c3ed8ce60d36df9284081640d5b6f15a56b9e3741673c2929
docker: Error response from daemon: driver failed programming external connectivity on endpoint nginx-1 (4f798eabb0de9c795f0a0ce20131872cd7e90d1009abe7b969e323a0b17ca47a): Error starting userland proxy: listen tcp 0.0.0.0:8000: bind: address already in use.

docker run -d --network my-bridge -p 1800:80 --name nginx-1 nginx
docker: Error response from daemon: Conflict. The container name "/nginx-1" is already in use by container "316f2c71f484dceb8bf646c471013a8ccbcda656a1483e11d0d01a0e23806989". You have to remove (or rename) that container to be able to reuse that name.

原因分析:宿主机端口被占用,无法映射。容器name被占用。

 解决方法:更换端口即可,更换容器name或删除重名容器name即可。

docker run -d --network my-bridge -p 1800:80 --name nginx-1 nginx

 

问题5:容器启动失败?

[root@controller flask-skeleton]# docker run -d -p 1080:5000 --name flask_1 chalon/flask-skeleton
ce68e3412a1870ea197d5b0d5aef8d13566cc16c6cead2ef60db89e4ee00cbce
docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "scripts/dev.sh": permission denied: unknown.
[root@controller flask-skeleton]# curl 127.0.0.1:1080
curl: (7) Failed connect to 127.0.0.1:1080; Connection refused
[root@controller flask-skeleton]# docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ce68e3412a18 chalon/flask-skeleton "scripts/dev.sh" 25 seconds ago Created 0.0.0.0:1080->5000/tcp flask_1

原因分析:scripts/dev.sh没有可执行权限。

解决方法:添加可执行权限,重新构建image后启动容器。

 

 

问题6:多服务容器启动,wordpress无法连接数据库mysql?

Error establishing a database connection

原因分析:不明;

解决方法:需在wordpress容器安装mysql客户端逐步排查无法连接mysql的原因。

 

问题7:etcd集群不能正常工作?

[root@controller etcd-v3.0.12-linux-amd64]# ./etcdctl cluster-health
cluster may be unhealthy: failed to list members
Error: client: etcd cluster is unavailable or misconfigured
error #0: dial tcp 127.0.0.1:4001: getsockopt: connection refused
error #1: client: endpoint http://127.0.0.1:2379 exceeded header timeout

原因分析:配置中hostname错误;

解决方法:修改配置即可。

 

问题8:image创建失败?

[root@k8s-master02 result-app]# docker build -t chalon/result-app ./
Sending build context to Docker daemon 1.184MB
Step 1/10 : FROM node:0.10
---> 0f9a0e09fbda
Step 2/10 : RUN mkdir /app
---> Running in 0321b7b2f5b2
Removing intermediate container 0321b7b2f5b2
---> 8d795e9bb388
Step 3/10 : WORKDIR /app
---> Running in 7ca49532f3b7
Removing intermediate container 7ca49532f3b7
---> 58748afc19c4
Step 4/10 : ADD package.json /app/package.json
---> 4f5f08c62c0e
Step 5/10 : RUN npm install && npm ls
---> Running in f5ab2ba34439
npm WARN package.json result-app@1.0.0 No description
npm WARN package.json result-app@1.0.0 No repository field.
npm WARN package.json result-app@1.0.0 No README data

原因分析:配置存在问题。

解决方法:description字段不能为空;添加registry的字段。

 

 

[root@k8s-master02 result-app]# docker build -t chalon/result-app ./
Sending build context to Docker daemon 1.184MB
Step 1/10 : FROM node:0.10
---> 0f9a0e09fbda
Step 2/10 : RUN mkdir /app
---> Using cache
---> 8d795e9bb388
Step 3/10 : WORKDIR /app
---> Using cache
---> 58748afc19c4
Step 4/10 : ADD package.json /app/package.json
---> Using cache
---> c7333a92115f
Step 5/10 : RUN npm install && npm ls
---> Running in e05a02c5b67b
npm WARN engine pg-int8@1.0.1: wanted: {"node":">=4.0.0"} (current: {"node":"0.10.48","npm":"2.15.1"})
npm WARN deprecated json3@3.3.2: Please use the native JSON object instead of JSON 3
npm WARN engine mime@1.6.0: wanted: {"node":">=4"} (current: {"node":"0.10.48","npm":"2.15.1"})
async@1.5.2 node_modules/async

cookie-parser@1.4.5 node_modules/cookie-parser
├── cookie-signature@1.0.6
└── cookie@0.4.0

......

└─┬ socket.io-parser@2.3.1
├── component-emitter@1.1.2
├─┬ debug@2.2.0
│ └── ms@0.7.1
├── isarray@0.0.1
└── json3@3.3.2

Removing intermediate container e05a02c5b67b
---> 73f9571d0a01
Step 6/10 : RUN mv /app/node_modules /node_modules
---> Running in 5b76670218c0
Removing intermediate container 5b76670218c0
---> ead730b37022
Step 7/10 : ADD . /app
---> e367d9a62950
Step 8/10 : ENV PORT 80
---> Running in 3357446624d6
Removing intermediate container 3357446624d6
---> e4307660ca86
Step 9/10 : EXPOSE 80
---> Running in f2f6542425da
Removing intermediate container f2f6542425da
---> d8b58f297738
Step 10/10 : CMD ["node", "server.js"]
---> Running in ab6f4bb146a0
Removing intermediate container ab6f4bb146a0
---> 548bcacf2006
Successfully built 548bcacf2006
Successfully tagged chalon/result-app:latest
[root@k8s-master02 result-app]#

 

问题8:构建image失败?

[root@k8s-master02 worker]# docker build -t chalon/worker ./
Sending build context to Docker daemon 10.75kB
Step 1/9 : FROM java:7
---> 5dc48a6b75af
Step 2/9 : RUN apt-get update -qq && apt-get install -y maven && apt-get clean
---> Using cache
---> e51e0fcc4b8f
Step 3/9 : WORKDIR /code
---> Using cache
---> 3c22c8edba80
Step 4/9 : ADD pom.xml /code/pom.xml
---> 6f98a2d5e4a1
Step 5/9 : RUN ["mvn", "dependency:resolve"]
---> Running in a019d51bdaea
[INFO] Scanning for projects...
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-jar-plugin/2.4/maven-jar-plugin-2.4.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-jar-plugin:2.4: Plugin org.apache.maven.plugins:maven-jar-plugin:2.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-jar-plugin:jar:2.4
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/3.1/maven-compiler-plugin-3.1.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-compiler-plugin:3.1: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:3.1
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-assembly-plugin/2.2-beta-5/maven-assembly-plugin-2.2-beta-5.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5: Plugin org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-assembly-plugin:jar:2.2-beta-5
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-clean-plugin:2.5: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-install-plugin:2.4: Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-install-plugin:jar:2.4
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.3/maven-resources-plugin-2.3.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-resources-plugin:2.3: Plugin org.apache.maven.plugins:maven-resources-plugin:2.3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.3
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.10/maven-surefire-plugin-2.10.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-surefire-plugin:2.10: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.10 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-surefire-plugin:jar:2.10
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-deploy-plugin:2.7: Plugin org.apache.maven.plugins:maven-deploy-plugin:2.7 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-deploy-plugin:jar:2.7
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-site-plugin/3.0/maven-site-plugin-3.0.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-site-plugin:3.0: Plugin org.apache.maven.plugins:maven-site-plugin:3.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-site-plugin:jar:3.0
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-antrun-plugin/1.3/maven-antrun-plugin-1.3.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-antrun-plugin:1.3: Plugin org.apache.maven.plugins:maven-antrun-plugin:1.3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-antrun-plugin:jar:1.3
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5: Plugin org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-assembly-plugin:jar:2.2-beta-5
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/2.1/maven-dependency-plugin-2.1.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-dependency-plugin:2.1: Plugin org.apache.maven.plugins:maven-dependency-plugin:2.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-dependency-plugin:jar:2.1
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-release-plugin/2.0/maven-release-plugin-2.0.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-release-plugin:2.0: Plugin org.apache.maven.plugins:maven-release-plugin:2.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-release-plugin:jar:2.0
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
[WARNING] Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Received fatal alert: protocol_version
[WARNING] Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Received fatal alert: protocol_version
[WARNING] Failure to transfer org.apache.maven.plugins/maven-metadata.xml from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Received fatal alert: protocol_version
[WARNING] Failure to transfer org.codehaus.mojo/maven-metadata.xml from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): Received fatal alert: protocol_version
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.845s
[INFO] Finished at: Tue Aug 03 09:16:33 UTC 2021
[INFO] Final Memory: 12M/92M
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'dependency' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/root/.m2/repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException
The command 'mvn dependency:resolve' returned a non-zero code: 1

原因分析:worker缺少jar包。

解决方法:添加相应jar包即可。

 

posted on 2021-07-13 10:08  chalon  阅读(1958)  评论(0编辑  收藏  举报