---
# System prepended metadata

title: Dockerfiles Spot the Flaws (alternate instructions)

---

# Dockerfiles Spot the Flaws (alternate instructions)

If you run the project at each step (as it says in the original README), this project will go VERY slowly. Here’s an alternative approach to this project that might make it a little more interesting. Instead of starting from the actual instructions in the README, start by opening the Dockerfile.

## Project Overview
In this project, you are given a Dockerfile for running a simple Express server. But the Dockerfile has been written very badly—your job is to rewrite it more effectively and efficiently!

## Suggested Approach
Try to figure out what each command in the Dockerfile is for. With your partner, come up with all the flaws that you recognize, and think about simplifying it as much as possible. Some of these steps may be unfamiliar—that’s probably because they are examples of bad practice for a Docker image. How many steps do you think this Dockerfile actually needs to run your application?

Only once you’ve brainstormed together, should you take a look at the instructions. Read through them all the way before you start making changes or building the image from your Dockerfile (also, double check that the versions they specify actually make sense. New versions come out all the time, and the instructions may be a few months behind). Once you are satisfied that you’ve observed good practices, you can try building your Dockerfile.

Your revised image will be smaller and the build will be much faster than if you’d tried to run the version you were provided with initially.

## HINTS:
If you get stuck (and only if you get stuck), look below for guidance. These are two different minimal sets of steps that would be good approaches to creating an image for this application. Each step corresponds to a single command.

### Approach 1

- Step 1: Use the most-specific base image and version tag
- Step 2: Change directories
- Step 3: Copy in all your files
- Step 4: Install dependencies
- Step 5: Run the application

### Approach 2

- Step 1: Use the most-specific base image and version tag
- Step 2: Change directories
- Step 3: Copy in only the file(s) you need to install dependencies
- Step 4: Install dependencies
- Step 5: Copy in the rest of the files
- Step 6: Run the application
