Passing a file to a running container
Your manager is pleased at your new knowledge of Docker data sharing and comes by with a scenario they'd like you to investigate. The primary application from your company is named crane
and has been recently containerized by your department. This application is personalized for each of your company's customers and, thus far, has required building and maintaining a separate container image for each client. Your manager would like you to find a method to simplify this process.
After reviewing the container configuration, you see that each container image looks for a file named customerdata.json
within the image. This file holds the specific customer information and must be placed into each image at build time.
This exercise is part of the course
Intermediate Docker
Exercise instructions
- Run the container image
crane
using the appropriate Docker command. You should see a message referencing the default user information. - Modify the
~/workspace/customerdata.json
file and update theCompany Name
entry to The File Store. - Run the container image
crane
again, this time passing the~/workspace/customerdata.json
file to the path/customerdata.json
in the container. Make sure to use the paths as shown.
Hands-on interactive exercise
Turn theory into action with one of our interactive exercises
