Skip to content

Latest commit

 

History

History
68 lines (63 loc) · 2.11 KB

2.docker-exercises.md

File metadata and controls

68 lines (63 loc) · 2.11 KB

Docker - Exercises

These are steps to complete the two exercises in Docker that I demonstrated yesterday, a recording of which is available here on YouTube.

Exercise 1

Running a simple C programme in Docker

Steps:

  1. Navigate to the Docker Playground.
  2. Add a new instance of Docker in the playground.
  3. Analyze the C programme code given in this repository.
  4. Clone the repository inside Docker Playground and open the folder.
    git clone https://github.com/paramsiddharth/docker-calcsum-example.git
    
    cd docker-calcsum-example
  5. Build the image using Docker.
    docker build -t c_code .
  6. Check the newly-created image using
    docker images
  7. Execute the image in a temporary interactive container.
    docker run --rm -it c_code
  8. Delete the image.
    docker rmi c_code
  9. Exit Docker Playground.

Exercise 2

Running a simple web server in Docker

Steps:

  1. Navigate to the Docker Playground.
  2. Add a new instance of Docker in the playground.
  3. Have an overview of this repository.
  4. Clone the repository inside Docker Playground and open the folder.
    git clone https://github.com/paramsiddharth/docker-static-website-lighttpd.git
    
    cd docker-static-website-lighttpd
  5. Build the image using Docker.
    docker build -t static_website .
  6. Check the newly-created image using
    docker images
  7. Execute the image in a temporary container, mapping local port 3000 to port 80 of the container.
    docker run --rm -p 3000:80 static_website
  8. Open port 3000 in the playground to visit the website launched.
  9. Press Ctrl+C or Cmd+C while in the playgroud terminal to stop the container.
  10. Delete the image.
docker rmi static_website
  1. Exit Docker Playground.

Made with ❤ by Param.