1. List of 5 Commands to Troubleshoot Docker Images
Question:
Please provide a list of five commands that are commonly used to troubleshoot issues related to Docker images. Briefly explain the purpose of each command.
Answer: Below are 5 troubleshooting commands:
logs	Shows the container logs
ps	Lists the containers
stats	Displays container resources
top	Displays container processes
events	Shows real-time docker events
2. What is Docker Image?
Question:
What is a Docker image? Provide a concise definition and describe its primary components and purpose within the Docker ecosystem.
Answer: Docker images are the blueprint for containers, they typically contain the applications. Below are the primary components:
Layers - Represents each layer within the docker image.
Base Image - Represents the minimal OS image or application runtime environment
Dockerfile - scripting file used for creation of image for automation
3. How to Create a Docker Image Using a Container?
Question:
Describe the process of creating a Docker image using an existing container. Include the key commands involved in this workflow.
Answer: Export and import commands are used to create a docker image from an existing container.
 
docker export ash-ub-git-ap > ash-ub-git-ap.tar
Exports the filesystem of a container as a tar
cat ash-ub-git-ap.tar | docker import - ash-ub-git-ap:imported
Creates an image from a tarball
4. How to Create a Docker Image Using a Dockerfile?
Question:
Explain how to create a Docker image by utilizing a Dockerfile. Outline the general steps and the primary command used to build the image.
Answer:
Create the Dockerfile
# Dockerfile
FROM ubuntu:latest
RUN apt-get update && \
    apt-get install -y git apache2 && \
    apt-get clean
CMD ["/bin/bash"]
Save this as Dockerfile.
 
Build the image
docker build -t ubuntu-git-apache2:dockerfile .
 
List the images
docker images
5. Top 10 Instructions of Dockerfile
Question:
List the top ten instructions commonly used in a Dockerfile. For each instruction, provide a brief description of its function.
Answer: 
FROM: Specifies the base image for building the new image
RUN: executes command
COPY: copies files from local to image
ADD: copies files, download from URLs and also can extract the archives
ENTRYPOINT: Defines the first command to execute once the container starts. Used before CMD
CMD: Defines the command to execute the once the container starts. Can be used to provide arguments to ENTRYPOINT
EXPOSE: used to expose the port
ENV: used to set variables
USER: used to run the apps in container as specific user
WORKDIR: Sets the working directory after executing a command
6. How to Upload Docker Images to a Docker Registry
Question:
Describe the procedure for uploading Docker images to a Docker registry. Include the sequence of commands typically required for this process.
Answer: The procedure to upload docker images to a Docker registry requires login to the docker registry and then push the image to the registry.
docker login docker tag ash-ub-git-ap:dockerfile ab/my_webapp:latest docker push ab/my_webapp:latest