Docker is a platform for developers and sysadmins to develop, deploy, and run applications with containers. The use of Linux containers to deploy applications is called containerization. Containers are not new, but their use for easily deploying applications is.
Containerization is increasingly popular because containers are:
A container is launched by running an image. An image is an executable package that includes everything needed to run an application--the code, a runtime, libraries, environment variables, and configuration files.
A container is a runtime instance of an image--what the image becomes in memory when executed (that is, an image with state, or a user process). You can see a list of your running containers with the command, docker ps, just as you would in Linux.
A container runs natively on Linux and shares the kernel of the host machine with other containers. It runs a discrete process, taking no more memory than any other executable, making it lightweight.
By contrast, a virtual machine (VM) runs a full-blown “guest” operating system with virtual access to host resources through a hypervisor. In general, VMs provide an environment with more resources than most applications need.
For full Kubernetes Integration
docker --versionDocker version 17.12.0-ce, build c97c6d6
2. Run docker info or (docker version without--) to view even more details about your docker installation:
docker infoContainers: 0Running: 0Paused: 0Stopped: 0Images: 0Server Version: 17.12.0-ceStorage Driver: overlay2...
To avoid permission errors (and the use of sudo), add your user to the docker group.
docker run hello-worldUnable to find image 'hello-world:latest' locallylatest: Pulling from library/hello-worldca4f61b1923c: Pull completeDigest: sha256:ca0eeb6fb05351dfc8759c20733c91def84cb8007aa89a5bf606bc8b315b9fc7Status: Downloaded newer image for hello-world:latestHello from Docker!This message shows that your installation appears to be working correctly....
2. List the hello-world image that was downloaded to your machine:
docker image ls
3. List the hello-world container (spawned by the image) which exits after displaying its message. If it were still running, you would not need the --all option:
docker container ls --allCONTAINER ID IMAGE COMMAND CREATED STATUS54f4984ed6a8 hello-world "/hello" 20 seconds ago Exited (0) 19 seconds ago
## List Docker CLI commandsdockerdocker container --help## Display Docker version and infodocker --versiondocker versiondocker info## Excecute Docker imagedocker run hello-world## List Docker imagesdocker image ls## List Docker containers (running, all, all in quiet mode)docker container lsdocker container ls --alldocker container ls -aq
Containerization makes CI/CD seamless. For example:
With Docker, scaling your application is a matter of spinning up new executables, not running heavy VM hosts.