Changing behavior when starting a container
Let's see how the ENV Dockerfile instruction works in practice. We've added a Dockerfile to your current working directory with the following instructions:
FROM ubuntu:22.04
ENV NAME=Tim
CMD echo "Hello, my name is $NAME"
The Dockerfile will print a personalized message, Hello, my name is Tim, on startup. Let's see how we can change this personalized message even after building an image from the Dockerfile.
This exercise is part of the course
Introduction to Docker
Hands-on interactive exercise
Turn theory into action with one of our interactive exercises
Start Exercise