DCA - Section 1 Getting Started With Docker
DCA - Section 1 Getting Started With Docker
ISSUED BY
Zeal Vora
REPRESENTATIVE
[email protected]
Module 1: Introduction to Docker
1.1 Understanding the Challenge
Every software has its own set of pre-requisite dependencies which much be present before the
installation. This leads to many sets of challenges depending on the operating system used.
Along with the above challenge, the second primary issue is related to OS compatibility. A
software written for Windows might not work for Linux and MAC and so on.
These are some of the primary challenges which Docker is trying to solve.
1.2 Introduction to Docker
Docker is a technology designed to make it easier to create, deploy, and run applications by
using containers.
Docker is an open platform, once we build a docker container, we can run it anywhere, say it
windows, Linux, mac whether on a laptop, data center, or in the cloud.
https://docs.docker.com/get-docker/
By default, if we do not specify the name, docker supplies a randomly-generated name from two
words, joined by an underscore
By default Docker containers can make connections to the outside world, but the outside world
cannot connect to containers.
If we want containers to accept incoming connections from the world, you will have to bind it to a
host port.
Module 6: Attached and Detached Mode
When we start a docker container, we need to decide if we want to run in a default foreground
mode or the detached mode.
You may want to use this if you want a container to run but do not want to view and follow all its
output.
Description Command
Stop all the containers docker container stop $(docker container ls -aq)
The cli commands were then refactored to have the form docker COMMAND SUBCOMMAND,
wherein this case the COMMAND is container and the SUBCOMMAND is run
The command started using docker exec only runs while the container’s primary process (PID
1) is running, and it is not restarted if the container is restarted.
This command can be defined while we are defining the container image.
We can override the default container command by manually specifying the command.
In the above command, the sleep 500 will run as a PID 1 process overriding any default
command that would be present in the nginx container.
Docker provides restart policies to control whether your containers start automatically when they
exit, or when Docker restarts.
We can specify the restart policy by using the --restart flag with docker run command.
With the --rm flag, the user can specify that whenever a container exits, it should automatically
be removed.
We invite you to join our Discord community, where you can interact with our support team for
any course-based technical queries and connect with other students who are doing the same
course.
Joining URL:
http://kplabs.in/chat