Assigenment-3 Docker
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
- Components of Docker and its Brief Summary
ans: The Docker components are divided into two categories; basic and advanced.
basic docker components:
Docker Client: it allows user to communicate with docker.
Docker Image: Docker images are used to build containers and hold the entire metadata that elaborates the capabilities of the container.
Docker Daemon: It runs as a background process that manages parts like Docker networks, storage volumes, containers, and images.
Docker Container: A Docker container is the instance of an image that can be created, started, moved, or deleted through a Docker API
Docker Advanced Components:
Docker Compose: Sometimes you want to run multiple containers but as a single service. This task can be accomplished with the help of Docker compose as it is specifically designed for this goal.
Docker Swarm: If developers and IT admins decide to create or manage a cluster of swarm nodes in the Docker platform, they can use the Docker swarm service. - What is the differenet between docker pause and unpause?
ans: The Docker pause command is used to pause an existing Docker container. To unpause the container, we use “docker unpause” command. - What is the differenet between docker stop and kill?
ans: The docker kill subcommand kills one or more containers. The docker stop command attempts to stop a running container first by sending a SIGTERM signal to the root process (PID 1) in the container. - What is the differenet between docker exec and attach?
ans: docker exec executes a new command . Use docker attach to attach your terminal’s standard input, output, and error to a running container using the container’s ID or name. - List of dockerfile instructions and its Brief Summary?
ans: FROM – to pull base images like alpine, ubuntu,etc..
ADD – add the files to the images(ADD supports remote urls(not encourged to use) and automaticalls unzips tar balls
RUN – executes durint the image creation like RUN apk add wget
COPY – copy the files to images
EXPOSE – expose the port of the container
ENRTYPOINT[“java”,”jar”,”webappp.jar”] start the process you want to run after staring the container]
CMD – to pass on defaults for for an container.the paramenters for entry point can be passed using CMD. - What is the differenet between CMD vs Entrypoint
ans: CMD – The CMD describes the default container parameters or commands. The user can easily override the default command when you use this. ENTRYPOINT – A container with an ENTRYPOINT is preferred when you want to define an executable. You can only override it if you use the –entrypoint flag. - List of 20 docker commands and its use cases with example?
ans: docker –versionThis command is used to get the currently installed version of docker
docker pull : This command is used to pull images from the docker repository(hub.docker.com)
This command is used to create a container from an image
docker ps: This command is used to list the running containers
docker ps -a:This command is used to show all the running and exited containers
docker exec: This command is used to access the running container
docker stop: This command stops a running container
docker kill: This command kills the container by stopping its execution immediately.
docker commit: This command creates a new image of an edited container on the local system
docker login: This command is used to login to the docker hub repository
docker push: This command is used to push an image to the docker hub repository
docker images: This command lists all the locally stored docker images
docker rm: This command is used to delete a stopped container
docker rmi: This command is used to delete an image from local storage
docker build: This command is used to build an image from a specified docker file