A minimal Dockerfile looks like this:
FROM alpine
CMD ["echo", "Hello StackOverflow!"]
This will instruct Docker to build an image based on Alpine (FROM
), a minimal distribution for containers, and to run a specific command (CMD
) when executing the resulting image.
Build and run it:
docker build -t hello .
docker run --rm hello
This will output:
Hello StackOverflow!