Menu
CoddyTech

Personalize The Greeting

Part of the Introduction to Docker section of Coddy's Terminal journey. Lesson 36 of 40.

challenge icon

Challenge

Medium

Make the greeting read from a file you ship inside the image. A file named name.txt (containing a user's name) is already in your directory. Run these steps one after the other:

  1. Open Dockerfile from the file tree and change it to: FROM alpine, then COPY name.txt /name.txt, then CMD ["cat", "/name.txt"]. Save it
  2. Build it tagged greetapp
  3. Run it so the name prints

Try it yourself

Terminal
docker build -t greetapp .
docker run greetapp

All lessons in Introduction to Docker

Practice on your own: Terminal playground