Docker Interview Questions and Answers
Question - 31 : - What is memory-swap flag?
Answer - 31 : -
Memory-swap is a modified flag that only has meaning if- memory is also set. Swap allows the container to write express memory requirements to disk when the container has exhausted all the RAM which is available to it.
Question - 32 : - Write a Docker file to create and copy a directory and built it using python modules?
Answer - 32 : -
FROM pyhton:2.7-slim
WORKDIR /app
COPY . /app
docker build –tag
Question - 33 : - Where the docker volumes are stored?
Answer - 33 : -
You need to navigate:
/var/lib/docker/volumes
Question - 34 : - List out some important advanced docker commands
Answer - 34 : -
Command | Description |
docker info | Information Command |
docker pull | Download an image |
docker stats | Container information |
Docker images | List of images downloaded |
Question - 35 : - How does communication happen between Docker client and Docker Daemon?
Answer - 35 : -
You can communicate between Docker client and Docker Daemon with the combination of Rest API, socket.IO, and TCP.
Question - 36 : - Explain Implementation method of Continuous Integration(CI) and Continues Development (CD) in Docker?
Answer - 36 : -
You need to do the following things:
- Runs Jenkins on docker
- You can run integration tests in Jenkins using docker-compose
Question - 37 : - What are the command to control Docker with Systemd?
Answer - 37 : -
systemctl start/stop docker
service docker start/stop
Question - 38 : - How to use JSON instead of YAML compose file?
Answer - 38 : -
docker-compose -f docker-compose.json up
Question - 39 : - What is the command you need to give to push the new image to Docker registry?
Answer - 39 : -
docker push myorg/img
Question - 40 : - How to include code with copy/add or volumes?
Answer - 40 : -
In docker file, we need to use COPY or ADD directive. This is useful to relocate code. However, we should use a volume if we want to make changes.