Docker Assignment & Projects

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

How to submit assignment?

Write Ansswer for the following questions and submit answer at BestDevOps.com as new post for each questions


1. Components of Docker and its Brief Summary

2. What is the differenet between docker pause and unpause?

3. What is the differenet between docker stop and kill?

4. What is the differenet between docker exec and attach?

5. List of dockerfile instructions and its Brief Summary?

6. What is the differenet between CMD vs Entrypoint

7. List of 20 docker commands and its use cases with example?

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

23 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
B Vijay Kumar
B Vijay Kumar
2 years ago

1. Components of Docker and its Brief Summary
 docker client – a way for docker users to communicate with Docker
 docker host – consists dockerd(daemon),containers and images 
 registry – stores images. we can use docker pull to pull images from registry. 
2. What is the differenet between docker pause and unpause?
 pause – to stop the process running inside containers
 inpause- to resume the paused process inside containers
3. What is the differenet between docker stop and kill?
 – docker stop command stops the containers gracefully where as kill command terminates the entrypoint process abruptly(which can incurr of data or damage to file system)
4. What is the differenet between docker exec and attach?
 – attach – used for trouble shooting , to exit container to should be stopped.not user friendly to run the commands.
 – exec – we can get into running container and commands.
  
5. List of dockerfile instructions and its Brief Summary?
 – 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.
       
 example : 
 CMD[“192.168.1.1”]
 ENTRYPOINT[“ping”,”-t”,”5″]
 
 this will ping the ip provided in CMD 5 times
 
6. What is the differenet between CMD vs Entrypoint
 – 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.
       
 example : 
 CMD[“192.168.1.1”]
 ENTRYPOINT[“ping”,”-t”,”5″]
 

Abhinav Jaroli
Abhinav Jaroli
2 years ago

1) Docker Components:
a) Docker engine
b) VM image = bootfs+rootfs+userfs+apps
c) Docker Images = rootfs + userfs + apps
When we create one container one copy of image is mounted into container.

2) Docker pause will pause the running container and unpause will start the pause container.
docker pause/unpause container id/ container name

3) A docker STOP command issues a SIGTERM signal to the main process running within the container while KILL command issues a SIGKILL signal to the process.

4) Use docker attach to attach terminal’s standard input, output, and error (or any combination of the three) to a running container using the container’s ID or name. This allows to view its ongoing output or to control it interactively, as though the commands were running directly in terminal.
Docker exec is a command that allows the execution of any given command within a Docker container.

5) FROM must be the first non-comment instruction in the Dockerfile
The MAINTAINER instruction allows you to set the Author field of the generated images.
RUN  (shell form, the command is run in a shell, which by default is /bin/sh -c on Linux or cmd /S /C on Windows)
The LABEL instruction adds metadata to an image.
EXPOSE : Informs Docker that the container listens on the specified network port(s) at runtime.

6) ENRTYPOINT : It start the process want to run after staring the container]
 CMD :To pass on defaults to container the paramenters for entry point can be passed using CMD.

Pavani
Pavani
2 years ago

1.Docker client enables user to interact with the docker
Docker host provides complete environment to execute and run applications.
DockERD is a background that manages images, containers, nerworks and storage volumes.
Docker containers provide lightweight and platform independent way of running your applications .
2.pause th process but still keep the memory portion when the container is paused. While unpause ti reduce the paused process inside the container
3 docket stop command stops the container abruptly and provides a safe way out. docker kill terminates the entry point and provides unsafe exit
4.the docker container was started using /bin/bash command, you can access it using attach, if not then you need to execute the command to create a bash instance inside the container using exec. Attach isn’t for running an extra thing in a container, it’s for attaching to the running process.
6. The purpose of cmd is to provide defaults to container
Entrypoint helps to configure a container and you can run as executable.
5. docker –version

This command is used to get the currently installed version of docker
docker pull

Usage: docker pull

This command is used to pull images from the docker repository(hub.docker.com)
docker run

Usage: docker run -it -d

This command is used to create a container from an image
docker ps

This command is used to list the running containers

Ibrahim Jalloh
Ibrahim Jalloh
2 years ago

1. Docker works via a Docker engine that is composed of two key elements: a server and a client; and the communication between the two is via REST API. 
The server communicates the instructions to the client.

2. What is the difference between docker pause and docker unpause? Docker pause suspends all the process to container. 
Docker unpause will un-suspend all the process to container.

3. docker stop: Stop a running container (send SIGTERM, and then SIGKILL after grace period) The main process inside…
  docker kill: Kill a running container (send SIGKILL, or specified signal) The main process inside the container…

4. Both docker exec and attach are used to connect or access the container but only difference is that docker exec creates a 
differrent process to access the container whereas docker attach connects to the same standard input/out or the same terminal.

5. There are a variety of Dockerfile instructions we can put in our Dockerfile. These include FROM, RUN, WORKDIR, COPY, ADD, VOLUME, CMD, ENTRYPOINT, WORKDIR, USER, ONBUILD, LABEL, ARG, SHELL, HEALTHCHECK, EXPOSE and ENV. 
You can see a full list of the available Dockerfile instructions here.

6. ENTRYPOINT should be defined when using the container as an executable. CMD should be used as a way of defining default arguments for an ENTRYPOINT command or for executing an ad-hoc command in a container. 
CMD will be overridden when running the container with alternative arguments.

Sunil
Sunil
2 years ago

Components of Docker and its Brief Summary1 Docker client: it is used to communicate with the docker server (dockerd)
2 Docker server: it contains dockerd and container
Docker image: the docker templet which contains info of the docker container.
Docker registry : library of images .
Docker container: the full package which we required to run an application .

What is the difference between docker pause and unpause?pause: to stop the process running inside containers.
unpause- to resume the paused process inside containers.

What is the difference between docker stop and kill?Docker stop: stop a running container
Docker kill: kills a running container.

What is the difference between docker exec and attach?Docker exec: will enter into the container and start interacting.
by using >> docker exec -it NAME /bin/bash
Docker attach: it will directly take us to PID 1 of the container, we use this for troubleshooting
by using docker attach NAME
List of docker file instructions and its Brief Summary?FROM: create a base image like httpd , ubuntu.
RUN: to build the container
MAINTAINER: creator of images.
ENV: an environment for image
COPY: copy the file to images
What is the difference between CMD vs EntrypointENTRYPOINT: act as an entry point to the container.
CMD: we use to set the commend it will execute while running the container.

Prasanna Kumar Panda
Prasanna Kumar Panda
2 years ago

1.           Components of Docker and its Brief Summary
Docker client and server collectively called as docker engine
Registry (remote as well as Local)
Docker image and containers
2.           What is the differenet between docker pause and unpause?
Pause #  the container process remains active but all container specific services stop transactions
Unpause # resumes
3.           What is the differenet between docker stop and kill?
Docker stop # shuts down the container process
Docker kill # removes the container
4.           What is the differenet between docker exec and attach?
Docker exec # runs a process insdie the container by invoking the command from host
Docker attach # docker start + docker exec to prevent PID conflict during container creation
5.           List of dockerfile instructions and its Brief Summary?
Dockerfile briefly covers the name of image , additional software installation , binding or copying the source code from the repository path and the initial executions
This can be used by using statements with functions like Pull , run ,add ,copy etc
6.           What is the differenet between CMD vs Entrypoint
Entrypoint Starts a process after starting the container and CMD defines the default parameters to be used along with entry point command

Ashish 1234
Ashish 1234
2 years ago
Rupa
Rupa
2 years ago

Components of docker and its brief summary
main components of docker are
Docker Swarm – Docker swarm is an orchestration service within docker that allows us to manage and handle multiple containers at the same time.
Docker Images – Docker images act as a set of instructions to build a docker container.
Docker Compose – Compose is a tool for running multiple containers.

difference between pause and unpause
docker pause will suspends all the processes inside the container,where as unpause will resume the processes

Difference between kill and stop
Docker kill will kill one or more containers .Docker stop will stop the running container

rupa
rupa
2 years ago

Components of docker and its brief summary
main components of docker are
Docker Swarm – Docker swarm is an orchestration service within docker that allows us to manage and handle multiple containers at the same time.
Docker Images – Docker images act as a set of instructions to build a docker container.
Docker Compose – Compose is a tool for running multiple containers.
difference between pause and unpause
docker pause will suspends all the processes inside the container,where as unpause will resume the processes
Difference between kill and stop
Docker kill will kill one or more containers .Docker stop will stop the running container

Sai Charan.T
2 years ago

1. Components of Docker and its Brief Summary
Docker client – Docker user to communicate with Docker
  Docker host – It Consists of dockerd(daemon),containers and images 
  Registry – It stores images where we can use docker pull to pull images from registry. 

Sai Charan.T
2 years ago

2. What is the differenet between docker pause and unpause?
Pause is to stop the process running inside containers
  Unpause is to resume the paused process inside containers

Sai Charan.T
2 years ago

3. What is the differenet between docker stop and kill?
Docker stop command stop a running container by sending SIGTERM signal to the root (PID 1) in container.
Docker kill command kills one or more containers.

Sai Charan.T
2 years ago

4. What is the differenet between docker exec and attach?
Docker exec executes new command or create a new process in container
Docker attach conncects the standard input/output/error of main process inside the container.

Sai Charan.T
2 years ago

5. List of dockerfile instructions and its Brief Summary?
FROM: Create a basic image like httpd.
RUN: It is to build the container
MAINTAINER: Creates the images.
ENV: Environment for image.
COPY: Copies the file to images.

Sai Charan.T
2 years ago

6. What is the differenet between CMD vs Entrypoint?
CMD commands are ignored by Daemon when there are parameters stated within the docker run command.
ENTRYPOINT instructions are not ignored but instead are appended as command line parameters by treating those as arguments of the command.

Sai Charan.T
2 years ago

7. List of 20 docker commands and its use cases with example?
Docker version
We usually start by finding the installed version of docker that we are working on.

Docker search 
The “docker search” command searches for specific images through the Docker hub. This command returns the specific information, including image name, description, automated, official stars, etc.

Docker pull
As the name suggests, this command pulls a specific image from the Docker Hub. All you have to do is use the command ‘docker pull’ along with the name of the image. Here is an example of pulling an image without using the tag. 

Docker run 
This command is used to create a container from an image.

Docker ps
This command is used to list all the running containers in the background. 

Docker stop 
The ‘docker stop’ command stops a container using the container name or its id. 

Docker restart 
This command is used to restart the stopped container. It is recommended to use this after rebooting the system.

Docker kill
This command is used to stop the container immediately by killing its execution. While the ‘docker stop’ command helps shut down the container in its own time, the ‘docker kill’ command stops it at once.

Docker exec 
This command is used to access the container that is running. 

Docker login
This command helps you to log into your docker hub. As you try to log in, you will be asked to give your docker hub credentials. 

Docker commit 
This command is used to create or save an image of the edited container on the local system. 

Docker push 
This command helps push or upload a docker image on the repository or the docker hub. 

Docker network 
The ‘docker network’ command is used to know the details of the list of networks in the cluster. 

Docker rmi 
This command is used to free up some disk space. The image id is used to remove the image while using this command.

Docker ps -a
This command is used to know the details of all the running, stopped, or exited containers. 

Docker copy
This command copies a file from docker to the local system.

Docker logs  
This command is used to check the logs of all the docker containers with the corresponding contained id mentioned in the command.

Docker volume 
This command creates a volume so that the docker container can use it to store data.

Docker logout 
This command will log you out of the docker hub. 

basebbeh
basebbeh
1 year ago

1. Components of Docker and its Brief Summary?

Docker client and server: Docker Engine is installed on the server side and the client side just consist of the Command Line Interface used for issuing commands to Docker Engine.

Docker image: A Docker image is a file used to execute code in a Docker container.
 
Docker registry:  A Docker registry is a storage and distribution system for named Docker images.

Docker container: A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application.
 

basebbeh
basebbeh
1 year ago

2. What is the difference between Docker pause  and unpause?
 
If we want to pause the processes running inside the container, we use the “docker pause” command. To unpause the container, use “docker unpause” command.

basebbeh
basebbeh
1 year ago

3. What is the difference between Docker stop and kill?
 
The Docker Stop command stops the container gracefully and provides a safe way out.

If a Docker Stop command fails to terminate a process within the specified timeout, the Docker issues a kill command implicitly and immediately.

basebbeh
basebbeh
1 year ago

4. What is the difference between Docker exec and attach?
Docker exec executes a new command or create a new process in the container’s environment.
 
Docker attach basically used to attach your host systems standard input, standard output and standard error with that of a container.
 

basebbeh
basebbeh
1 year ago

5. List of Dockerfile instructions and its Brief Summary?
There are a variety of Dockerfile instructions we can put in our Dockerfile.
These includes:

  • ADD:  Add the files to the images.
  • COPY:  Used to copy files and directories inside a Docker container from your Local machine.
  • EXPOSE: The instruction exposes a particular port with a specified protocol inside a Docker Container. 
  • FROM: To pull base images like alpine,ubuntu,etc.
  • LABEL: Labels are used in Dockerfile to help organize your Docker Images.
  • USER: We are going to use the user instruction to switch the user inside the Container from Root to the one which we will create. 
  • WORKDIR:  Instruction is used to set the working directory for all the subsequent Dockerfile instructions. 
basebbeh
basebbeh
1 year ago

6. What is the difference between CMD vs Entrypoint.

  • CMD: Sets default command and parameters, which can be overwritten from command line when Docker container runs.
  • ENTRYPOINT: Command and parameters will not be overwritten from command line. Instead, all command line arguments will be added after entry points parameters.
basebbeh
basebbeh
1 year ago

7. List of 20 Docker commands and its use cases with  example?
Docker ps: This command is used to list all the running containers in the background.

Docker ps -a: This command is used to know the details of all the running, stopped, or exited containers.

Docker version: We usually start by finding the installed version of docker that we are working on.

Docker pull: As the name suggests, this command pulls a specific image from the Docker Hub. All you have to do is use the command ‘docker pull’ along with the name of the image. Here is an example of pulling an image without using the tag.

Docker run: This command is used to create a container from an image.

Docker stop: The ‘docker stop’ command stops a container using the container name or its id.

Docker restart: This command is used to restart the stopped container. It is recommended to use this after rebooting the system.

Docker kill:This command is used to stop the container immediately by killing its execution. While the ‘docker stop’ command helps shut down the container in its own time, the ‘docker kill’ command stops it at once.

Docker login:This command helps you to log into your docker hub. As you try to log in, you will be asked to give your docker hub credentials.

Docker network:The ‘docker network’ command is used to know the details of the list of networks in the cluster.

Docker-compose down: You need to stop all services declared in a docker-compose file.
Docker-compose logs: Your service crashed on launch and you want to know why.
Docker-compose stop: You want to stop your container by service name or container name.
Docker-compose restart: You want to restart a container with the service name or container name.

Docker-compose exec:  You want to access inside the launched container and execute something, similar with docker exec. 
Docker-compose down: You need to stop all services declared in a docker-compose file.
Docker rmi:  You need more space on your disk.      

23
0
Would love your thoughts, please comment.x
()
x