Be smart. Think open source.

Dockerfile Hands-On

Build your first image

Use what you learned until now to build your first image

Build a Docker image nginx:demo with these instructions:

  • Based on nginx:stable
  • Add your name as a maintainer
  • Create a index.html file in /usr/share/nginx/html
  • Run the container and expose the container port 80

Build your first image


FROM nginx:stable
LABEL maintainer=""
LABEL"Foo Bar"
LABEL com.example.version="0.0.1"

COPY index.html /usr/share/nginx/html/

Build, Run & Check

docker build -t nginx:demo .
docker run -p 8080:80 nginx:demo
xdg-open http://localhost:8080

Feel Free to Contact Us

Tech Blog