Docker Community Forums

Share and learn in the Docker community.

NooB: lstat ... no such file or directory - whats wrong with my Dockerfile?

docker

(Ds2k5) #1

Hello,
i use OpenSuSE 42.1 (64bit) with Docker: 1.9.1.
Like to build my own Image from OpenSuSE Leap 42.1
mounted ISO to /media

My Dockerfile:

FROM scratch
ADD //media/suse/x86_64/bash-4.2-76.4.x86_64.rpm /bash-4.2-76.4.x86_64.rpm
RUN rpm -ivh /bash-4.2-76.4.x86_64.rpm

dockeradmin@linux-ra62:~> ls -la /media/suse/x86_64/bash-4.2-76.4.x86_64.rpm
-r–r--r-- 6 root root 350983 Oct 25 2015 /media/suse/x86_64/bash-4.2-76.4.x86_64.rpm

dockeradmin@linux-ra62:~> docker build .
Sending build context to Docker daemon 17.41 kB
Step 1 : FROM scratch
—>
Step 2 : ADD //media/suse/x86_64/bash-4.2-76.4.x86_64.rpm /bash-4.2-76.4.x86_64.rpm
lstat /media/suse/x86_64/bash-4.2-76.4.x86_64.rpm: no such file or directory

if run twice:

dockeradmin@linux-ra62:~> sudo docker build .
Sending build context to Docker daemon 19.46 kB
Error response from daemon: 404 page not found

System did not have a connect to the internet

User is in the group: docker

Information about Docker:

dockeradmin@linux-ra62:~> sudo docker version
root’s password:
Client:
Version: 1.9.1
API version: 1.21
Go version: go1.6.2
Git commit: a34a1d5
Built:
OS/Arch: linux/amd64

Server:
Version: 1.9.1
API version: 1.21
Go version: go1.6.2
Git commit: a34a1d5
Built:
OS/Arch: linux/amd64

dockeradmin@linux-ra62:~> sudo docker version
root’s password:
Client:
Version: 1.9.1
API version: 1.21
Go version: go1.6.2
Git commit: a34a1d5
Built:
OS/Arch: linux/amd64

Server:
Version: 1.9.1
API version: 1.21
Go version: go1.6.2
Git commit: a34a1d5
Built:
OS/Arch: linux/amd64
dockeradmin@linux-ra62:~> sudo docker info
Containers: 3
Images: 0
Server Version: 1.9.1
Storage Driver: btrfs
Build Version: Btrfs v4.1.2+20151002
Library Version: 101
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 4.1.27-27-default
Operating System: openSUSE Leap 42.1 (x86_64)
CPUs: 1
Total Memory: 3.86 GiB
Name: linux-ra62
ID: YPRT:6TMV:GZSJ:VLE7:73QW:X7YT:QIX2:AXEB:IKDV:MQSG:NJJ3:T6FT
WARNING: No swap limit support

What did i wrong ?

Thanks


(David Maze) #2

You can’t ADD or COPY things from outside the current directory. Outside Docker copy whatever artifacts to the current directory or a subdirectory first.

If you do get here, this won’t work: your FROM scratch container won’t have a /usr/bin/rpm to run, or anything else at all: it’s a totally blank filesystem. If you’re starting FROM scratch then your basic options are to ADD a complete Linux distribution filesystem tar file, COPY in an all-in-one statically linked binary like Busybox, or COPY in a statically linked application binary.

It’s almost always easier to start from one of the prebuilt Linux distribution images, e.g. FROM ubuntu:16.04. (There’s absolutely no requirement that containers and the host run the same distribution.)