Docker Assignment– 1

Docker Core Concepts

Basic Questions

  1. Install Docker on a Linux system using the package manager and verify installation.
  2. Install Docker on Windows using Docker Desktop and verify installation.
  3. Install Docker on Mac using Docker Desktop and verify installation.
  4. Run the hello-world container to confirm Docker is working.
  5. Run an nginx container in detached mode.
  6. List all running containers using docker ps.
  7. List all containers (running and stopped) using docker ps -a.
  8. Stop a running container and verify it is no longer running.
  9. Start a stopped container and verify it is running again.
  10. Remove a stopped container.
  11. Download an image from Docker Hub using docker pull.
  12. List all images available locally.
  13. Inspect an image using docker inspect and note its layers.
  14. Inspect a running container using docker inspect.
  15. View logs of a running container.
  16. Run a container and use docker exec to open a shell inside it.
  17. Run multiple nginx containers with different names.
  18. Remove an unused image from your system.
  19. Explain the difference between Docker images and containers by creating both.
  20. Create a simple text note explaining Docker architecture: Client, Daemon, Registry, and Objects.

Intermediate Questions

  1. Pull the latest ubuntu image and run it interactively with a shell.
  2. Run an alpine container and execute echo “Hello from Alpine”.
  3. Start two containers from the same image and verify they are independent.
  4. Run a container, stop it, and restart it using the same container ID.
  5. Run a container with a custom name and check its logs.
  6. Use docker exec to create a new file inside a running container.
  7. Use docker cp to copy a file from host to a running container.
  8. Use docker cp to copy a file from container back to host.
  9. Create three nginx containers and map each to a different host port.
  10. Check logs of multiple containers simultaneously.
  11. Inspect a container and print only its IP address using docker inspect.
  12. Inspect an image and print only its size using docker inspect.
  13. Tag an image with a custom name and version.
  14. Remove multiple containers in a single command.
  15. Remove multiple images in a single command.
  16. Run a container in interactive mode, install a package, and check changes.
  17. View resource usage of containers using docker stats.
  18. Rename a running container and verify the new name.
  19. Save an image to a .tar file and then load it back.
  20. Push a pulled image to your Docker Hub account (requires login).

Advanced Questions

  1. Write a shell script to install Docker automatically on Linux.
  2. Create and run five containers of nginx, each mapped to different ports, and verify access in browser.
  3. Create a container, exec into it, install curl, and test connectivity from inside.
  4. Run a container with environment variables set and verify them inside.
  5. Use docker inspect with a filter to show only environment variables of a container.
  6. Run a container with limited CPU and memory resources.
  7. Run a container in detached mode and reconnect to it using docker exec.
  8. Pull a private image from a private registry after logging in.
  9. Compare image vs container: create an image, run a container, modify it, and commit changes.
  10. Document and demonstrate the entire Docker workflow: pull image → run container → exec → logs → stop/start → remove.