General Flashcards
What is Docker?
Docker is an open platform for developing, shipping, and running applications in containers.
What are Docker containers?
Docker containers are lightweight, standalone, executable packages that include everything needed to run a piece of software, including the code, runtime, libraries, and settings.
How does Docker differ from virtual machines?
Docker containers share the host system’s kernel and resources, making them more lightweight and efficient compared to virtual machines, which require a full OS instance for each VM.
What command is used to list all Docker containers?
The command is ‘docker ps’ for running containers and ‘docker ps -a’ for all containers. PS stands for “Process Status”
What file is used to define a multi-container Docker application?
A Docker Compose file, usually named ‘docker-compose.yml’, is used to define multi-container Docker applications.
How do you build a Docker image from a Dockerfile?
Use the command ‘docker build -t image_name .’, where ‘image_name’ is your desired image name and ‘.’ specifies the current directory containing the Dockerfile.
What is the purpose of a Dockerfile?
A Dockerfile is a script containing a series of instructions on how to build a Docker image.
What command is used to start a Docker container?
The command is ‘docker run’.
How do you remove a Docker container?
Use the command ‘docker rm container_id’, where ‘container_id’ is the ID of the container you want to remove.
What command is used to stop a running Docker container?
The command is ‘docker stop container_id’, where ‘container_id’ is the ID of the running container.
How can you view the logs of a Docker container?
Use the command ‘docker logs container_id’.
What is Docker Hub?
Docker Hub is a cloud-based repository where Docker users can create, test, store, and distribute container images.
How do you pull an image from Docker Hub?
Use the command ‘docker pull image_name’.
What is the purpose of the ‘docker-compose up’ command?
The ‘docker-compose up’ command starts and runs the entire application as defined in the ‘docker-compose.yml’ file.
How do you share data between Docker containers?
You can share data between Docker containers using Docker volumes.
What is a Docker volume?
A Docker volume is a storage mechanism that allows data to persist beyond the lifecycle of a container.