Docker: Create an image with VOLUME & EXPOSE instructions

Level : Beginner
Mentor: Shailendra Chauhan
Type : GuidedLab
Points : 10
Duration : 00:25:00

Lab Details

Problem Statement:

Write a Dockerfile that:

  • Uses the VOLUME instruction to create a mount point with a volume.
  • Uses the EXPOSE instruction to document the port the container listens on.
  • Verify the volume is created, and data persists, and test the exposed port by running the container and accessing the service.

Lab Objective:

Upon completion of this lab, you will be able to:

  • Understand the syntax and purpose of VOLUME and EXPOSE instructions.
  • Grasp how VOLUME creates a mount point and ensures data persistence.
  • Learn how to EXPOSE documents in the container's listening port and enable access to services.

Prerequisites

You should install the following software on your machine:

  • Docker
  • Text Editor
  • Terminal/Command Line Interface
Self-paced Membership
  • 24+ Video Courses
  • 825+ Hands-On Labs
  • 400+ Quick Notes
  • 50+ Skill Tests
  • 10+ Interview Q&A Courses
  • 10+ Real-world Projects
  • Career Coaching Sessions
  • Email Support
Upto 60% OFF
Know More
Still have some questions? Let's discuss.
CONTACT US
Accept cookies & close this