Containers & Dockers
Containers
Dockers and Architecture
Lab– Installing Docker on VM
Lab– Installing Docker on Local with linux Subsystem and run code on Windows and linux container
Azure Container
-----------------------------------------------------------------------
Azure Containers
A standard package of software—known as a container—bundles an
application's code together with the related configuration files and
libraries, and with the dependencies required for the app to run. This
allows developers and IT pros to deploy applications seamlessly across
environments.
Virtual machines and containers differ in several ways, but the primary
difference is that containers provide a way to virtualize an OS so that
multiple workloads can run on a single OS instance. With VMs, the
hardware is being virtualized to run multiple OS instances. Containers’
speed, agility, and portability make them yet another tool to help
streamline software development.
https://docs.microsoft.com/en-us/virt...
bout/containers-vs-vm
--------------------------------------------------------------------------------
Docker
Docker Architecture
Docker uses a client-server architecture. The Docker client talks to the Docker daemon, which does the heavy lifting of building, running, and distributing your Docker containers. The Docker client and
daemon can run on the same system, or you can connect a Docker client to a remote Docker daemon. The Docker client and daemon communicate using a REST API, over UNIX sockets or a network
interface. Another Docker client is Docker Compose, that lets you work with applications consisting of a set of containers
The Docker daemon
The Docker daemon (dockerd) listens for Docker API requests and manages Docker objects such as images, containers, networks, and volumes. A daemon can also communicate with other daemons to
manage Docker services.
The Docker client
The Docker client (docker) is the primary way that many Docker users interact with Docker. When you use commands such as docker run, the client sends these commands to dockerd, which carries them
out. The docker command uses the Docker API. The Docker client can communicate with more than one daemon.
Docker registries
A Docker registry stores Docker images. Docker Hub is a public registry that anyone can use, and Docker is configured to look for images on Docker Hub by default. You can even run your own private
registry.When you use the docker pull or docker run commands, the required images are pulled from your configured registry. When you use the docker push command, your image is pushed to your
configured registry.
Docker objects
When you use Docker, you are creating and using images, containers, networks, volumes, plugins, and other objects. This section is a brief overview of some of those objects.
Docker is an open platform for developing, shipping, and running applications. Docker
enables you to separate your applications from your infrastructure so you can deliver
software quickly. With Docker, you can manage your infrastructure in the same ways you
manage your applications. By taking advantage of Docker’s methodologies for shipping,
testing, and deploying code quickly, you can significantly reduce the delay between writing
code and running it in production.
----------------------------------------------------------------------------------------------------
Some Basic Labs for Docker
Virtual Machine
Update the apt package index and install packages to allow apt to use a repository over HTTPS:
Add Docker’s official GPG key:
Use the following command to set up the stable repository.
Install Docker Engine and pull nginx container image from Docker
LocalDesktop
Install Windows Subsystem (Virtual Machine Plateform, Windows Subsystem for Linux)
Install Docker Desktop https://docs.docker.com/docker-for-wi... nginx )
Install Ubuntu 20.04 LTS
To Enable Windows Based Container- Enable windows feature (Container , Hyper V)
1-$sudo apt-get update
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
2-$ curl -fsSL https://download.docker.com/linux/ubu... |
sudo gpg --dearmor -o
/usr/share/keyrings/docker-archive-keyring.gpg
3- echo \
"deb [arch=amd64
signed-by=/usr/share/keyrings/docker-archive-keyring.gpg]
https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee
/etc/apt/sources.list.d/docker.list /dev/null
4- sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo docker run --name mynginx -p 80:80 -d nginx
To see list of running docker -Sudo docker ps
To see list of all docker -Sudo docker ps -a
To see all the images- sudo docker image ls
For stop contain – sudo docker container stop/start [id]
The installation steps can be referred to the following link -
https://docs.docker.com/engine/instal...
-----------------------