Docker is an open-source project that automates the deployment of applications inside software containers, by providing an additional layer of abstraction and automation of operating-system-level virtualization on Linux.
We can say light-weighted virtual machine.
3 years ago
VM
Docker
Docker is based on LXC (Linux Containers) which allows
it to isolate containers from each other.
LXC use mainly two Linux Kernel features to acheave it :
Programmatically speaking, if an image is a class, then a container would be an instance of this class.
So, you can launch multiple containers for the same image (multiple instances).
docker ps command lists all running containers :
Configuration Free
containers include the minimal runtime requirements of the application, reducing their size and allowing them to be deployed quickly.
Portability across machines
an application and all its dependencies can be bundled into a single container that is independent from the host version of Linux kernel, platform distribution, or deployment model. This container can be transfered to another machine that runs Docker, and executed there without compatibility issues.
Version control and component reuse
you can track successive versions of a container, inspect differences, or roll-back to previous versions. Containers reuse components from the preceding layers, which makes them noticeably lightweight.
Sharing
you can use a remote repository to share your container with others.
http://docs.docker.com/installation
http://docs.docker.com/installation
from Docker Hub
Pulls per Day
Pulls per Second
Repositories on
Docker Hub
docker pull ubuntu
docker pull ubuntu(:16.04)
docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
ubuntu latest 91e54dfb1179 16 minutes ago 188.4 MB
hello-world latest af340544ed62 4 minutes ago 960 B
docker run -it ubuntu
image
container
docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
396fa752515e ekkinox/image2 "/bin/bash" 20 minutes ago Up 20 minutes high_panini
aa60196275a3 ekkinox/image1 "/bin/bash" 29 minutes ago Up 29 minutes reverent_fermi
c7f259822acb ubuntu:16.04 "/bin/bash" 36 minutes ago Up 36 minutes awesome_elion
70ef83fa7097 ubuntu:14.04 "/bin/bash" 37 minutes ago Up 37 minutes silly_mclean
698cd8bd50fe nazarpc/phpmyadmin "/home/entrypoint.sh" 17 hours ago Up 17 hours 0.0.0.0:1234->80/tcp doclersfbasicworkshop_phpmyadmin_1
4c5dd41b5a55 doclersfbasicworkshop_nginx "nginx -g 'daemon off" 18 hours ago Up 18 hours 0.0.0.0:80->80/tcp, 443/tcp doclersfbasicworkshop_nginx_1
e58a4384d27a mysql:5.6 "docker-entrypoint.sh" 18 hours ago Up 18 hours 0.0.0.0:3306->3306/tcp doclersfbasicworkshop_db_1
faf8aba5cd3c doclersfbasicworkshop_php "php-fpm" 18 hours ago Up 18 hours 9000/tcp doclersfbasicworkshop_php_1
image
container
docker commit high_panini test_image
image
container
docker push test_image
image
container
A Dockerfile is a recipe of what the image will be :
FROM ubuntu:16.04
RUN mkdir -p /home/test
$ docker build -t test_image .
To build an image from this Dockerfile :