I need hello.rpm
when I build from Dockerfile, but this rpm file is not available online.
Right now I'm serving the file by firing up a temporary web server, but ideally I'd like to run a build command which makes this local file available inside the container.
Is this possible?
My build command:
docker build -t fredrik/helloworld:1.0 .
My Dockerfile:
FROM centos:6 RUN rpm -ivh hello.rpm
They get stored as a series of layers in your Docker root directory. On Linux, it's /var/lib/docker .
The best way to work around this is to specify the Dockerfile independently of the build context, using -f. For instance, this command will give the ADD command access to anything in your current directory. docker build -f docker-files/Dockerfile . docker build -f ../Dockerfile .
If you use the default storage driver overlay2, then your Docker images are stored in /var/lib/docker/overlay2 . There, you can find different files that represent read-only layers of a Docker image and a layer on top of it that contains your changes.
Why don't you COPY the file inside the container before executing RUN
?
FROM centos:6 COPY hello.rpm /tmp/hello.rpm RUN rpm -ivh /tmp/hello.rpm
This assumes that hello.rpm
is next to your Dockerfile
when you build it.
Otherwise if an internet connection is not a limiting factor while you're working just:
wget https://www.cloudnameXYZ.com/filename
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With