Personalize The Greeting
Part of the Introduction to Docker section of Coddy's Terminal journey. Lesson 36 of 40.
Challenge
MediumMake 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:
- Open
Dockerfilefrom the file tree and change it to:FROM alpine, thenCOPY name.txt /name.txt, thenCMD ["cat", "/name.txt"]. Save it - Build it tagged
greetapp - Run it so the name prints
Try it yourself
Terminal
docker build -t greetapp .
docker run greetappAll lessons in Introduction to Docker
4Managing Containers
Naming ContainersDetached ContainersListing All ContainersStopping And RemovingRecap - Container Lifecycle10Greeting App Project
Project OverviewWrite The DockerfilePractice on your own: Terminal playground