{"id":192339,"date":"2020-06-09T08:00:40","date_gmt":"2020-06-09T00:00:40","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=192339"},"modified":"2020-05-25T09:54:15","modified_gmt":"2020-05-25T01:54:15","slug":"docker-yum-error","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/docker-yum-error.html","title":{"rendered":"\u89e3\u51b3Docker\u8c03\u7528yum\u62a5\u9519\u7684\u95ee\u9898"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | \u5728\u672c\u7bc7\u6587\u7ae0\u91cc\u5c0f\u7f16\u7ed9\u5927\u5bb6\u5206\u4eab\u7684\u662f\u5173\u4e8edocker\u5bb9\u5668\u8c03\u7528yum\u62a5\u9519\u7684\u89e3\u51b3\u529e\u6cd5\uff0c\u6709\u5174\u8da3\u7684\u670b\u53cb\u4eec\u53ef\u4ee5\u53c2\u8003\u4e0b\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n dockerfile\u91cc\u6216\u8005\u5728\u5bb9\u5668\u91cc\u6267\u884cyum\uff0c\u62a5\u9519\uff0c\u627e\u4e0d\u5230\u6e90(invalid baseurl xxx)\uff0c\u4f46\u662f\u5bbf\u4e3b\u673a\u4e0a\u6267\u884cyum\u662f\u6ca1\u95ee\u9898\u7684\u554a\uff0c\u4e3a\u4ec0\u4e48\uff1f<\/p>\n \u56e0\u4e3a\u4e0d\u8bba\u662fdockerfile\u4f7f\u7528RUN\u5173\u952e\u5b57\u6267\u884cyum\u8fd8\u662f\u76f4\u63a5\u8fdb\u5165\u5230\u5bb9\u5668\u91cc\u9762\u6267\u884cyum\uff0c\u5b83\u4eec\u90fd\u662f\u4f7f\u7528\u7684docker\u955c\u50cf\u91cc\u9762\u7684\u6e90(CentOS\u662f\u5728\u8def\u5f84\/etc\/yum.repo.d\/CentOS-Base.repo)\uff0c\u6240\u4ee5\u4f60\u8981\u628a\u5bbf\u4e3b\u673a\u4e0a\u7684\u540c\u8def\u5f84\u4e0b\u7684\u6e90\u62f7\u8d1d\u5230\u5bb9\u5668\u91cc\u9762\uff0c\u7136\u540edocker commit\u4e00\u4e2a\u65b0\u7684\u201c\u57fa\u7840\u955c\u50cf\u201d\uff0c\u8fd9\u4e2a\u65f6\u5019\u4f7f\u7528docker build xxx(\u5373\u4f7f\u7528Dockerfile\u7684\u65b9\u5f0f)\u5c31\u4e0d\u4f1a\u62a5\u9519\u4e86\u3002<\/p>\n \u62f7\u8d1d\u65b9\u6cd5docker cp xxx xxx<\/p>\n dockerfile\u4e2d\u6267\u884cyum\u64cd\u4f5c\u62a5\u9519<\/strong><\/div>\n \u6211\u4eec\u5148\u770b\u4e0b\u62a5\u9519\u4fe1\u606f\uff1a<\/p>\n \r\nSending build context to Docker daemon 9.363 MB\r\nStep 1 : FROM docker.io\/centos\r\n---> 196e0ce0c9fb\r\nStep 2 : MAINTAINER liuliangliang\r\n---> Using cache\r\n---> 7d7e06799c20\r\nStep 3 : ADD file\/tomcat7.tgz \/usr\/local\/\r\n---> Using cache\r\n---> 10ffdea53a02\r\nStep 4 : RUN yum install java-1.8.0-openjdk -y\r\n---> Running in 7824a339e077\r\nLoaded plugins: fastestmirror, ovl\r\n\r\n\r\nOne of the configured repositories failed (Unknown),\r\nand yum doesn't have enough cached data to continue. At this point the only\r\nsafe thing yum can do is fail. There are a few ways to work \"fix\" this:\r\n\r\n1. Contact the upstream for the repository and get them to fix the problem.\r\n\r\n2. Reconfigure the baseurl\/etc. for the repository, to point to a working\r\nupstream. This is most often useful if you are using a newer\r\ndistribution release than is supported by the repository (and the\r\npackages for the previous distribution release still work).\r\n\r\n3. Run the command with the repository temporarily disabled\r\nyum --disablerepo= |