uSING DOCKERFILES TO SHARE IMAGES


sHARING IMAGES



Shipping images can be painful


docker pull goldmann/wildfly


117mb download with Fedora images cached locally


SHARING images


It's even worse if you don't have a registry

 docker export 6f91f81c9293 > wildfly.tar

Creates 1.7G file
700MB after gzip compression

getting the latest bits



Use the latest base image

No need to:

apt-get update

yum update 


trusting images


Unless you know how an images is built, you shouldn't trust it

Dockerfiles show how the images is built:

    FROM fedora
RUN yum install -y wildfly
EXPOSE 8080
ENTRYPOINT ["/usr/share/wildfly/bin/launch.sh"]

trusted build

Pulls the Dockerfile from git

Allows others to view source

Builds the images from the Dockerfile

wildfly8 example

FROM fedora 
Downloads the latest fedora image from the docker index

WILDFLY8 EXAMPLE

RUN yum install -y wildfly 
Downloads the Wildfly 8 bits from the fedora repo

WILDFLY 8 EXAMPLE

EXPOSE 8080 
Exposes port 8080 from the container

WILDFLY 8 ExAmple

 ENTRYPOINT ["/usr/share/wildfly/bin/launch.sh]
Sets the default executable to run

WILDFLY 8 EXAMPLE

    FROM fedora
RUN yum install -y wildfly
EXPOSE 8080
ENTRYPOINT ["/usr/share/wildfly/bin/launch.sh"]
Build it:
docker build -t wildfly8 . 
Run it:
docker run wildfly8 

Dockerfile

By Jason Shepherd

Dockerfile

  • 846