Skip to content

Practice Exercise 1:

Objectives

Run a Docker container with nginx

Scenario

You want to move from running services locally on Linux to containerized services using Docker instead.

Tasks

  • Connect to the web2 instance
  • Ensure that your Flask app is not running
  • Pull the nginx Docker image
    docker pull nginx
    
  • Run a Docker container based on the image you pulled:
    docker run -d -p 80:80 nginx
    
  • Access the service by visiting <NAME>-a1t-inf-ds-web2.acad.opswerks.net, you should see the default nginx web page.
  • List all containers:
    docker ps -a
    
  • Stop and delete the container:
    docker stop <container_id>
    docker rm <container_id>
    

Bonus points

  • Create a Docker container using a custom solution Hint: Utilize a Dockerfile

Conclusion

In summary, through this activity, you've gained practical knowledge in the basics of containerization and running services using Docker on a Linux system. Containers provide a powerful way to encapsulate, deploy, and manage applications, and these skills will be valuable for various IT and development tasks in the future.