Fly Friday - Customizing with Dockerfiles

Last week’s Fly Friday video showed how you can simply deploy a Docker image to Fly. Today, we’ll show how straightforward it is to customize that deployed image with Fly.

We deployed Docker’s official httpd image in our first Fly Friday video. That image, when run, serves up files from its /usr/local/apache2/html. By default the image contains the words “It works”. If we want it to say something else, we need to copy our content into that directory.

To do that we use a Dockerfile that is just two lines long.

FROM httpd:2.4
COPY ./public_html/  /usr/local/apache2/htdocs/

The Dockerfile contains all the instructions needed to create our new image. The FROM says take the Docker httpd image and use it as a base for our new image. The COPY says copy the contents of a local directory into /usr/local/apache2/html/ within the new image. Fly will then deploy that new image.

We’ll also have to create the public_html directory and put some HTML content in there.

Want to see all this in action? Watch this Fly Friday video:

Want to learn more about Fly? Head over to our Fly Docs for lots more, including a Hands On where you can get a free account and deploy your first app today.