Docker Fundamentals
Docker Process
1. Developer writes code locally and shares their work as a Docker Image. 2. Docker pushes applications to a test environment for automated and/or manual testing. 3. Bugs can be fixed in development environment and redeployed in test environment for re-testing and validation. 4. When testing is done then developers push the updated image to the production environment.
Production Environments
1. Local data center 2. Cloud provider 3. hybrid
Docker benefits
1. Responsive deployment(Docker image flexibility) 2.Scalable 3. Lightweight and fast 4. NOT a virtual machine
Virtual Machine
A VM runs a full blown guest OS with virtual access to host resources through a hypervisor. VM's incur a lot of overhead.
What is Docker?
A containerization application that provides the ability to run one or more applications in an isolated environment called a Container. Does not use a hypervisor and can be run on a single computer.
Docker Platform
A platform to manage the entire lifecycle of containters: 1. Develop app with docker components 2.Container is used to support testing. 3. Deploy into production environment as Container. 4. Process works for all production environments.
Docker Architecture
Docker uses client-server architecture. Docker client talks to Docker Daemon which builds, runs, and distributes Containers. Docker client and daemon communicate with a REST API.
Docker Engine
The docker engine is a client server application with three components: 1. A server, contains daemon also called dokerd. 2.Docker REST API, communicates to daemon 3. A command line interface(CLI)
Docker Container
This is created from a docker image when you use a docker run command. It is a runnable instance of an image with encapsulation features applied to keep it isolated from host. It interacts with its own private file system. Manages with docker CLI
docker compose
Tool for defining and running multi-container Docker applications. Uses a YAML file to configure an application's services.
Dockerfile
a text document that contains all the commands a user would call on the command line to assemble an image.
docker build -t myimage .
build an image called myimage from a dockerfile at "."
docker attach <containername>
connect to a running container
docker create myimage
creates a container from an image but does not start it
Docker Daemon
creates and manages Docker objects such as images, containers, networks, and volumes
docker rm <containername>
delete a stopped container
docker ps -a
list all containers, running or stopped
docker ps
list all running containers
docker image ls
list images on machine
docker container <command>
manage containers
docker push username/reponame:<tagname>
push an image to a repo in the docker registry
docker run <containername>
re-run a container
Docker Image
standalone executable package that is read only and includes all of the instructions needed to run an application and create a container: code, runtime, system tools and libraries, and settings. Images can be based on other images.
docker start <containername>
starts a container
docker stop <containername>
stops a running container
Docker registries
stores Docker images and can be interacted with from CLI with docker pull, docker run, and docker push.