
Docker
- what is docker Docker is a platform for building, running and shipping applications.
Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels. Wikipedia
Note: docker help us consistently build, run and ship applications
- Virtual Machines vs Containers
Container is an isolated environment for running an application
- allow running multiple apps in isolation
- are lightweight
- use OS of the host
- start quickly
- need less hardware resources
Virtual Machine is an abstriction of a machine (physical hardware)
- Architecture of Docker
Containers share the kernal of os Akerna managmes applications and hardware resources
-
Installing Docker you can visit: https://docs.docker.com/get-docker/ to install docker on your Operating system
-
Development Workflow
To build and run your app by docker, you need to make Dockerfile, it's an plain text file that contain the instruction for docker
- Docker in action
Instructions for deploying app
-
Start with an OS
-
Install node
-
Copy app files
-
Rung node app.js
-
Example:
-
create folder
hello-docker -
in folder create file
app.js -
in file set the following code:
console.log('Hello, Docker')- create
Dockerfile(width captal D only) in the root of your app - set the following instruction in the file:
FROM node:alpine COPY . /app WORKDIR /app CMD node app.js- to build and run your app by docker, open terminal in the folder that contain you app and run the following commands
- docker build -t hello-docker .
- you can check you images created by: docker images or docker image ls
- docker run hello-docker
- create
-
Related articles
The Hilarious Misadventures of a Dev Transitioning to Kubernetes
Dive into the comedic journey of a developer's transition to Kubernetes, exploring the pitfalls and triumphs with a light-hearted twist.
Embracing the Unknown: Strategies for Smoothly Transitioning Into a DevOps Role
Discover practical strategies and insights for software developers looking to transition into a DevOps role, ensuring a smooth career shift.
Surviving Your First Outage: A Developer's Guide to Post-Incident Growth
Learn how to turn a system outage into a growth opportunity with actionable insights and strategies for developers.