Menu
Coddy logo textTech

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 commands one after the other:

  1. Write a Dockerfile: FROM alpine, then COPY name.txt /name.txt, then CMD ["cat", "/name.txt"]
  2. Build it tagged greetapp
  3. Run it so the name prints

Try it yourself

Terminal
cat > Dockerfile << 'EOF'
FROM alpine
CMD ["echo", "Welcome to the greeting app"]
EOF
docker build -t greetapp .
docker run greetapp

All lessons in Introduction to Docker