Skip to content

NickMRamirez/docker_lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published