7. How do Docker containers work? Images and
containers
Dockerfile > Image > Container
• Dockerfile: text file recipe for image
• Image: read-only file system (i.e. template)
• Container: copy of an image (i.e. instance)
The container is what gets run and where apps go
11. Underneath Docker
• Docker typically uses the Linux container system (i.e. LXC), which can
run apps that run on Linux (now it also uses the new Windows
container system)
• Linux containers isolate processes
• Containers share the host operating system’s kernel - meant to create an
environment without the need for a separate kernel
12. Docker on Linux Containers
• Docker helps manage containers
• Docker abstracts machine-specific settings relating to networking, storing,
logging, etc.
• Docker makes it easy to create and distribute containers
• Docker allows containers to run on many different machines, with
many different configurations
• 1 process per container philosophy
13. Docker on Mac and Windows
• Docker runs containers on Linux kernel via virtual machine
• They can now also run on the Windows kernel
14. Benefits of containers
• Consistent
• Very portable
• Fast to spin up
• Smaller footprint
• Easy to scale
15. Open Container Initiative
• Docker is a runtime and container format based on the Open
Container Initiative
• Create open industry standards around container formats and
runtime
docker run example.com/org/app:v1.0.0
rkt run example.com/org/app,version=v1.0.0
16. Windows?
Docker can also use the container system new in Windows Server 2016 and
Windows 10, which can run Windows apps in containers
Source: Docker Blog
17. Where can I host applications in containers?
• Linux server
• VM on Azure, AWS, etc.
• Container service like AWS Container Service, Azure Container Service
• Many other hosts (Hadoop, etc.)
• Using scheduler/orchestrator like ECS, Kubernetes, Swarm, Mesos
18. Building & Deploying Overview
• Dev container, big
• Prod container, small
Dev container
- SDK
- Source code
- System files to support development
- Build artifacts
Prod container
- Build artifacts
19. Fun facts
• Average host runs 7 containers but goes way up
• 40% of Docker adopters are using an orchestrator
• Kubernetes, ECS, Swarm, etc.
20. Container Ecosystem
Container Management System
Orchestrator
Container Engine
Containerized Applications
Security controls, image security
scanning, centralized management
tools, app lifecycle management,
enterprise management
Scheduling, communication, service
discovery, load balancing, self-
healing, rolling updates, pipeline
management, federation, etc
Runs containers
Application packaged in a standard
way
Docker EE, OpenShift,
control plane
Cluster(s) managed by
Kubernetes, Swarm, Mesos,
Fleet
Docker on Azure/AWS/VM
App with React UI container,
ASP.NET Core API container
23. Popular images
• Redis: This popular key-value data store is often used as an in-memory database, message queue, or cache.
• Elasticsearch: Full-text search continues to increase in popularity, cracking the top 3 for the first time.
• Registry: 18% of companies running Docker are using Registry, an application for storing and distributing
other Docker images. Registry has been near the top of the list in each edition of this report.
• Postgres: The increasingly popular open source relational database edges out MySQL for the first time in this
ranking.
• MySQL: The most widely used open source database in the world continues to find use in Docker
infrastructure. Adding the MySQL and Postgres numbers, it appears that using Docker to run relational
databases is surprisingly common.
• etcd: The distributed key-value store is used to provide consistent configuration across a Docker cluster.
• Fluentd: This open source "unified logging layer" is designed to decouple data sources from backend data
stores. This is the first time Fluentd has appeared on the list, displacing Logspout from the top 10.
• MongoDB: The widely-used NoSQL datastore.
• RabbitMQ:The open source message broker finds plenty of use in Docker environments.
24. Benefits of using Docker for development
• Getting an environment running very fast
• Being able to share your environment with others
• Being able to extend your environment very fast and easily (i.e.
adding a Redis server)
• Consistent environments
• You can version development environments
• Development through Production
• Not polluting your computer with frameworks since they are installed
in the containers (git & Docker is all you need!)
27. Power clean commands
• Remove stopped containers:
docker rm $(docker ps -a -q)
• Remove all unused containers, volumes, networks and images (both dangling
and unreferenced):
docker system prune NOTE: add -a to remomve unnused images, not just dangling
28. Additional common commands
docker exec -ti <container ID or name> bash
docker logs <container ID or name>
docker inspect <container ID or name>
• View and manage volumes,
docker volume ls
docker volume inspect <name>
• View and manage networks,
docker network ls
docker network inspect <name>
29. Docker Compose
• Spin up multiple containers together
• Declare container settings
Common commands:
docker-compose up -d
docker-compose stop
docker-compose down
30. Other common commands
docker logs <container_name> [--tail 10]
docker exec -it <container_name> sh
docker volume … (ls, inspect, etc)
docker network … (ls, inspect, etc)
31. Getting ready to develop
1. Install Docker & go to the command line
2. Build an image by creating a Dockerfile & building
3. Create/go into an app directory (create app if needed)
4. Run the container. It will:
1. mount your directory
2. expose port(s)
3. run and watch your app
5. Proceed to develop as usual in your IDE of choice
33. Thanks!
@wynv | wyn.vandevanter@excella.com
Next Steps:
• Docker In-Depth, Swarm, Etc Workshop,
https://github.com/jpetazzo/container.training
• Getting Started with Docker Deployment Workshop
Editor's Notes
Downsides:
Extra complexity
- In the same way, Linux containers (ASP.NET Core)
- In the same way, Linux containers (ASP.NET Core)
-show images
-show all containers
-show images
-show all containers
-show images
-show all containers
-clean up what is there
-show quick running of existing container – with SDK
-build a container
-run it, stop it. Log in.
-change some code and re-run
-docker push
-clean up
-docker-compose
-clean up what is there
-show quick running of existing container – with SDK
-build a container
-run it, stop it. Log in.
-change some code and re-run
-docker push
-clean up
-docker-compose