1.包有问题报错
[root@test mydocker]# docker build -f /mydocker/tomcatfile -t mytomcat .
Sending build context to Docker daemon 80.07MB
Step 1/15 : FROM centos
---> 300e315adb2f
Step 2/15 : MAINTAINER zzyy<zzyybs@126.com>
---> Using cache
---> f256b257e270
Step 3/15 : COPY c.txt /usr/local/cincontainer.txt
---> Using cache
---> b656de0ad516
Step 4/15 : ADD jdk-linux-x64.tar.gz /usr/local/
failed to copy files: Error processing tar file(exit status 1): unexpected EOF
//这个报错是提示包有问题,由于包是从win主机下载再拖进虚拟机的,
//可能拖进来有问题,也有可能再win下的包就有问题,
//后来直接再虚拟机内部用浏览器下载了官方包就不报错了
2.网络配置有问题无法在线安装 vim
Step 6/15 : RUN yum -y install vim
---> [Warning] IPv4 forwarding is disabled. Networking will not work.
---> Running in 0d98535d29c7
CentOS Linux 8 - AppStream 0.0 B/s | 0 B 04:13
Errors during downloading metadata for repository 'appstream':
- 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]
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]
//解决办法 但为什么这么改还不知道
vi /etc/sysctl.conf
net.ipv4.ip_forward=1 #添加这段代码
#重启network服务
systemctl restart network && systemctl restart docker