1.包有问题报错

  1. [root@test mydocker]# docker build -f /mydocker/tomcatfile -t mytomcat .
  2. Sending build context to Docker daemon 80.07MB
  3. Step 1/15 : FROM centos
  4. ---> 300e315adb2f
  5. Step 2/15 : MAINTAINER zzyy<zzyybs@126.com>
  6. ---> Using cache
  7. ---> f256b257e270
  8. Step 3/15 : COPY c.txt /usr/local/cincontainer.txt
  9. ---> Using cache
  10. ---> b656de0ad516
  11. Step 4/15 : ADD jdk-linux-x64.tar.gz /usr/local/
  12. failed to copy files: Error processing tar file(exit status 1): unexpected EOF
  13. //这个报错是提示包有问题,由于包是从win主机下载再拖进虚拟机的,
  14. //可能拖进来有问题,也有可能再win下的包就有问题,
  15. //后来直接再虚拟机内部用浏览器下载了官方包就不报错了

2.网络配置有问题无法在线安装 vim

  1. Step 6/15 : RUN yum -y install vim
  2. ---> [Warning] IPv4 forwarding is disabled. Networking will not work.
  3. ---> Running in 0d98535d29c7
  4. CentOS Linux 8 - AppStream 0.0 B/s | 0 B 04:13
  5. Errors during downloading metadata for repository 'appstream':
  6. - Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=container [Could not resolve host: mirrorlist.centos.org]
  7. Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=container [Could not resolve host: mirrorlist.centos.org]
  8. //解决办法 但为什么这么改还不知道
  9. vi /etc/sysctl.conf
  10. net.ipv4.ip_forward=1 #添加这段代码
  11. #重启network服务
  12. systemctl restart network && systemctl restart docker