Hi
I am try to build a docker file using docker build command. Code is now given below:
FROM centos:8
# Set proxy environment variables
ENV export HTTP_PROXY=http://192.168.46.8:8080
ENV export HTTPS_PROXY=http://192.168.46.8:8080
COPY /etc/resolv.conf /etc/resolv.conf
# Set DNS servers
#RUN echo nameserver 8.8.8.8 >> /etc/resolv.conf
#RUN echo nameserver 8.8.4.4 >> /etc/resolv.conf
RUN yum update -y
RUN yum install -y httpd
COPY index.html /var/www/html/
EXPOSE 80
#httpdserver
CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"]
But I got find an error
=> ERROR [2/5] COPY /etc/resolv.conf /etc/resolv.conf
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref 37af8bf3-2769-4c5c-8f8f-a5748d9ead85::r7yqfnruqs28y4jx88q2xgq4f: "/etc/resolv.conf": not found
How to resolve issue anyone can support me. or find an attachment
First of all, you shouldn’t copy resolv.conf into a container, and not even during build. That is mounted from the host for each container and it is readonly during build. Docker supports setting the DNS server a parameter.