我想建立一个基于centos 7的docker映像,docker文件如下
FROM centos
MAINTAINER pengji jipeng92@gmail.com
WORKDIR /root
COPY MySQL-5.6.26 /mysql
RUN yum update
RUN yum -y install java-1.8.0-openjdk wget httpd php php-mysqlnd /mysql/*
RUN mysql_install_db --user=mysql
ENV MYSQL_ROOT_PASSWORD=root
ENV MYCAT_USER mycat
ENV MYCAT_PASS mycat
RUN wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-7/v7.0.64/bin/apache-tomcat-7.0.64.tar.gz
RUN tar xvf apache-tomcat-7.0.64.tar.gz -C /usr/local/ && mv /usr/local/apache-tomcat-7.0.64/ /usr/local/tomcat
RUN wget http://code.taobao.org/svn/openclouddb/downloads/old/MyCat-Sever-1.2/Mycat-server-1.2-GA-linux.tar.gz
RUN mkdir /usr/local/mycat && tar xvf Mycat-server-1.2-GA-linux.tar.gz -C /usr/local/mycat && useradd mycat && \
chown -R mycat.mycat /usr/local/mycat && chmod a+x /usr/local/mycat/bin/*
EXPOSE 8080 8066 9066
COPY /home/jipeng/dockerfiles/dataguru/java_tomcat_mysql/startup.sh /root/startup.sh
RUN chmod a+x /root/startup.sh
ENTRYPOINT /root/startup.sh
然后按命令生成
docker build -t pengji/mycat .
其过程如下
Sending build context to Docker daemon 317 MB
Step 0 : FROM centos
---> bb3d629a7cbc
Step 1 : MAINTAINER pengji jipeng92@gmail.com
---> Using cache
---> cdbbb4de4d8e
Step 2 : WORKDIR /root
---> Using cache
---> 6d6a40194219
Step 3 : COPY MySQL-5.6.26 /mysql
---> Using cache
---> 7cfa1ec8c6b9
Step 4 : RUN yum update
---> Running in fc44891ca20a
Loaded plugins: fastestmirror, ovl
One of the configured repositories failed (Unknown),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Disable the repository, so yum won't use it by default. Yum will then
just ignore the repository until you permanently enable it again or use
--enablerepo for temporary usage:
yum-config-manager --disable <repoid>
4. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
找不到存储库的有效基本URL:基本型/7/x86_64
我怎样才能解决这个问题呢?谢谢。
4条答案
按热度按时间nnsrf1az1#
也许你设置http_proxy和你的代理服务器是无法到达的。unset http_proxy
idv4meu82#
通过添加一些防火墙规则解决了此问题
参考编号:https://fedoramagazine.org/docker-and-fedora-32/
a2mppw5e3#
我有同样的问题,在我的情况下,由于MASQUERADE iptables规则在docker 0接口上丢失。
我通过tcpdump注意到容器试图用它自己的ip出去
.872491 IP(tos 0x 0,ttl 63,id 44842,偏移量0,标志[DF],协议TCP(6),长度60)
172.17.0.20.39146〉147.75.69.225.80:标志[S],校验和0x 856 e,序号241251313,赢29200,选项[mss 1460,sackOK,TS值67935451 ecr 0,nop,wscale 7],长度0
我在/etc/docker/daemon. json中添加了以下选项,最终容器已到达外部世界
请确保将deamon --iptables选项设置为true,否则将不会添加MASQUERADE规则。
总之看看
或者,也可以使用伪装创建自定义网络,并将其与容器关联
vlf7wbxs4#
这可以通过修复iptables来解决。
执行下列指令: