Ignoring Files During Docker Build

1 hour
  • 2 Learning Objectives

About this Hands-on Lab

### Ignoring Files During Docker Build

Greetings & welcome back to our next adventure! As the Radar Board (the official SpaceBones government tech team) works towards implementing a true CI/CD environment, there have been reports of random files, directories & other “errata” interrupting the Docker automation process.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create `.dockerignore`

Student should edit the included .dockerignore file under ~/content-dockerquest-spacebones/salt-example/salt-master/ to ignore the following: badscript.sh, README.md and all conf files.

.dockerignore:

badscript.sh
*.conf
README.md
Build the Docker Image

Student should create a new Docker image named salt-master:deb via

  docker build -t salt-master:deb .

From within the directory containing the Dockerfile

Additional Resources

As our resident Docker expert, President Squawk & the Radar Board have requested your aid in "ignoring" a few configuration files in the ~/content-dockerquest-spacebones/salt-example/salt-master/ directory. Populate the included .dockerignore file to prevent docker build from including incorrect or unneeded files in the build. Once complete, only docker-entrypoint.sh should live on the new image.

Once you have populated .dockerignore, build a new Docker container image named salt-master with the tag :deb.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?