Docker: Failed to connect to localhost port 80: Connection refused

In my docker file while building i want to access files on my host machine from localhost server rather than copying them to the

FROM busybox
RUN curl curl -L http://localhost/latest/myfile -o /root/myfile

I get errror:

Failed to connect to localhost port 80: Connection refused

Source: StackOverflow