Thursday 11 April 2024

Docker Interview Questions

Here are some Docker Interview Questions with answers and/or links to answers. Good luck! 💪🤞



  • What is .dockerignore? 
  • What is a Docker file?
  • Explain Docker file command FROM.
  • Explain Docker file command WORKDIR.
  • Explain Docker file command COPY.
    • What are its arguments?
    • What's the use case for COPY and what's use case for volume attribute in docker-compose.yaml? Which one is used in development and which one in production and why?
  • Explain Docker file command CMD.
  • How to create a Docker image?
    • Which Docker command shall be used? Which are its two main arguments?
    • What is the "build context"?
    • What's the meaning of its arguments: -t, -f?
  • How to download Docker image from the remote repository?
    • What are the long and short form of the command used?
    • Which tag gets applied if no tag is specified?
    • How many layers are downloaded in parallel by default?
    • Can layers be shared among multiple images?
    • Where are these images downloaded to?
    • Where from are the images downloaded from by default?
    • How would look the command that pulls the image from the local registry?
    • Which protocol does Docker use to communicate with registry?
    • How to pull multiple images from a repository?
    • How to cancel downloading image(s)?
    • docker pull | Docker Docs
  • How to list all images (on the local host)?
  • How to see the content of the Docker image?
  • How to list all running containers? 
    • How to list all containers?
  • How to list all containers (including those which are not running)?
  • How to inspect a container? 
    • How to extract only its ID? 
    • How to extract details about ports which are at this level in the JSON output: NetworkSettings >> Ports?
  • Whose alias is docker run
  • Whose alias is docker create
    • What does it do? 
    • What is its main argument? 
    • In which state is the container after this command is executed? 
    • How to start the container after this?
    • docker create | Docker Docs
  • docker-compose up
    • What is the difference between --build and --force-recreate arguments?
  • To Be Continued...


No comments: