NickMRamirez / docker_lab

Lab for learning about Docker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker Lab

Lab for learning about Docker

Pre-reqs

To speed up the class, please download the Docker images we'll be using ahead of time by using these commands:

docker pull node:alpine
docker pull redis
docker pull microsoft/aspnetcore-build:latest
docker pull microsoft/aspnetcore:latest

Hands-on

  1. Start a Docker container that uses the -v flag to create a volume that serves a node.js app

  2. Create a Dockerfile that:

    • Uses the node:alpine image
    • Uses RUN npm install
    • Uses CMD ["npm", "start"]
    • Copies the current directory's files into the image
    • Order the commands to make use of layer caching
  3. Use build arguments and labels in the Dockerfile to:

    • Add metadata, such as the version number of the image being built
  4. Use environment variables to:

    • Inject an environment variable into the container at runtime
    • Change the environment variable with docker run to change the text displayed on the webpage
  5. Use a .dockerignore file to:

    • Prevent files such as the Dockerfile from being copied into the image
  6. Create a Docker network named "mynet"

  7. Create a Redis container and the node.js app and use --network to put them both on the "mynet" network

  8. Put the name of the Redis server into the node.js container by using the -e flag to pass in an environment variable

About

Lab for learning about Docker


Languages

Language:C# 69.9%Language:PowerShell 10.0%Language:Shell 8.7%Language:JavaScript 8.2%Language:CSS 3.2%