Help to build a base Fedora Docker image

Keith Sharp kms at passback.co.uk
Wed Nov 26 14:23:03 UTC 2014


I've been trying to get to grips with Docker over the last few days, and as learning exercise I've been trying to build a chain of images from scratch, however I've run into some problems and I hope someone can put me on the right track.

I working in a VM running Fedora 21 Beta Server, fully up to date.  My Docker version is docker-io 1.3.2-2.fc21.

The steps I've taken are:

1) Downloaded Fedora-Docker-Base-20141029-21_Beta.x86_64.tar.gz to a directory called fedora and created a file in that directory called Dockerfile with only three lines:

FROM scratch
MAINTAINER Keith Sharp <kms at passback.co.uk>

ADD Fedora-Docker-Base-20141029-21_Beta.x86_64.tar.gz /

2) Used the docker command to build a new image:

$ sudo docker build -t passback/fedora:21beta .
Sending build context to Docker daemon 83.58 MB
Sending build context to Docker daemon 
Step 0 : FROM scratch
Pulling repository scratch
511136ea3c5a: Pulling image (latest) from scratch, endpoint: https://registry-1.511136ea3c5a: Download complete 
Status: Downloaded newer image for scratch:latest
 ---> 511136ea3c5a
Step 1 : MAINTAINER Keith Sharp <kms at passback.co.uk>
 ---> Running in 9091a442001f
 ---> bbcce511a8de
Removing intermediate container 9091a442001f
Step 2 : ADD Fedora-Docker-Base-20141029-21_Beta.x86_64.tar.gz /
 ---> 7058f928f119
Removing intermediate container de568a0cb7f8
Successfully built 7058f928f119

3) So far so good, the images show up as expected:

$ sudo docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
passback/fedora     21beta              7058f928f119        2 minutes ago       225.7 MB
scratch             latest              511136ea3c5a        17 months ago       0 B

4) However, when I try to launch my new image I hit a problem:

$ sudo docker run --rm -ti passback/fedora:21beta /bin/sh
2014/11/26 14:15:10 Error response from daemon: Cannot start container 19fad5c0c8e1a11784b616d17d632c9a8978bdfed2fb2aca75252e28619ef5c1: exec: "/bin/sh": stat /bin/sh: no such file or directory

5) I had thought it was because I was missing a CMD or ENTRYPOINT instruction so I tried creating a new image based on this Dockerfile:

FROM passback/fedora:21beta
MAINTAINER Keith Sharp <kms at passback.co.uk>

CMD ["/bin/bash"]

6) The build works, but when I try to run I get the same error:

$ sudo docker run --rm -ti passback/test
2014/11/26 14:19:24 Error response from daemon: Cannot start container 1a20d7ceade9f4bc2d729ca081c10d849fe941e748de804fb1ad75abbf4d4941: exec: "/bin/bash": stat /bin/bash: no such file or directory

I'm sure I'm missing something simple, but no amount of searching is helping.  Could someone point me in the right direction?

Thanks,

Keith.


More information about the cloud mailing list