Question:- What is a Docker Swarm?
Answer:- We can think of a Docker Swarm as the way of orchestrating the Docker containers. We will be able to implement Dockers in a cluster. We can convert our Docker pools into a single Docker Swarm for easy management and monitoring.
Question:- What is the use of a Dockerfile?
Answer:- A Dockerfile is a set of specific instructions that we need to pass on to Docker so that the images can be built. We can think of the Dockerfile as a text document which has all the commands that are needed for creating a Docker image. We can create an automated build that lets us execute multiple command lines one after the other.
Question:- What is Docker Compose?
Answer:- Docker Compose defines and runs multi-container Docker applications. With Compose, a YAML file is used to configure an application’s services. All the services from the configuration can be created and started with a single command.
Question:- Why use Docker?
Answer:- Following are the reasons why one should use Docker: It allows the use of system resources more efficiently Software delivery cycles are faster with it Application portability is possible and easy It is great for the microservices architecture
Question:- What are the drawbacks of Docker?
Answer:- Docker has a few drawbacks as listed below: • No storage option • Poor monitoring • Unable to automatically reschedule inactive nodes • Has a complicated automatic horizontal scaling setup
Question:- What is Docker Engine?
Answer:- Docker Engine is an open-source containerization technology that facilitates the development, assembling, shipping, and running of applications with the help of the following components: • Docker Daemon • Docker Engine REST API • Docker CLI
Question:- What are registries?
Answer:- Docker registries provide locations for storing and downloading images. There are two types of registries • Public registry • Private registry Public registries include Docker Hub and Docker Cloud.
Question:- What are Docker namespaces?
Answer:- When a container is run, Docker creates a set of isolated workspaces for the container called namespaces.
Question:- How to use Docker?
Answer:- The Docker command syntax looks like this: docker run [OPTIONS] IMAGE [COMMAND] [ARG...] To run a container, we must incorporate the image on which it is based: docker run [docker_image] We can run containers if the Docker images are locally stored. If they are not, the software will take it from the online registry. Docker can be used to run a container: • Under a specific name • Interactively • And publish container ports • In the background in the detached mode • And mount host volumes • And remove it once the process is complete
Question:- Is it possible to use JSON instead of YAML for Docker Compose?
Answer:- We can use JSON instead of YAML for a Docker Compose file. When we are using the JSON file for composing, we have to specify the filename with the following command: docker-compose -f docker-compose.json up
Question:- What is the process for creating a Docker container?
Answer:- We can use any specific Docker image for creating a Docker container using the below command: docker run -t -i command name This command not only creates the container but also starts it for us. If we want to check whether the Docker container has been created or not, then we need to have the following command that will list all the Docker containers, along with the host on which the Docker containers run: docker ps -a
Question:- What is the process for stopping and restarting a Docker container?
Answer:- To stop a Docker container, we need to use the following command: docker stop CONTAINER_ID To restart a Docker container, we need to use the following command: docker restart CONTAINER_ID
Question:- How to create a Docker image?
Answer:- A Docker image can be built using the following command: $ docker build .
Question:- How to stop a Docker container?
Answer:- We can use the following to stop one or more running Docker containers: docker container stop [OPTIONS] CONTAINER [CONTAINER...]