Docker overview
Why Docker
Before learning about Docker, let’s first look at why Docker appears.
When developing projects in the company, there are generally two sets of environments, one for development, one for online, and maybe a test environment, demonstration environment and so on. At this time, development and operation personnel are quite upset, and a set of code has to be deployed several times.
And it is very easy to appear a programmer often encountered phenomenon: it can run on my computer ah! Are you not configured wrong ah! You restart try and so on these questions….
When, for example, my version is updated and the service is not available, the test for operation and maintenance is very big
By now you’ve all heard the term DevOps, development is operations.
If a company has only one server, your project can be deployed only once, but only one server is almost a reality these days. If you have 10 servers, you have to deploy 10 times, what about 100, 1000?
There are a lot of programmers in Windows to do development, and the general server is Linux system, the Windows project deployment to Linux is also more troublesome.
The traditional solution is: development to release the code, operation and maintenance to do the deployment, is there a development deployment online, a set of processes can solve the solution?
Docker offers us a solution.
Docker history
Docker, a SAN Francisco-based company founded by French-American developer and entrepreneur Solumon Hykes, has the logo shown below.
Interestingly, Docker started as a platform-as-a-Service (PaaS) provider called dotCloud.
On the underlying technology, dotCloud platform utilizes Linux container technology. To facilitate the creation and management of these containers, dotCloud developed a set of internal tools, later named “Docker.” That’s how Docker was born!
In 2013, dotCloud’s PaaS business was slow, and the company needed to break new ground. So they hired Ben Golub as the new CEO, renamed the company “Docker”, abandoned the dotCloud PaaS platform, and embarked on a new journey with the mission of “promoting Docker and container technology to the world”.
Today Docker is widely regarded as an innovative technology company with a market value said to be around $1 billion. Docker has raised more than $240 million in multiple rounds of funding from Silicon Valley venture capital firms.
Before container technology, we used virtual machine technology
Virtual machines: Install VMware in Windows (others will do). You can use this software to create one or more virtual computers
Compare the differences between Docker and virtual machine technology:
- Traditional virtual machines (VMS) virtualize a piece of hardware, run a complete operation, and then install and run software on this system
- Docker container applications directly run in the host kernel, the container is not its own kernel, there is no virtual our hardware, so it is lightweight
- Docker containers are isolated from each other, and each container has its own file system, which does not affect each other
What can Docker do
1. Faster application delivery and deployment
- The traditional way: help documentation, setup, deployment environment, live
- Docker: Package images, publish tests, run with one click
2. Convenient upgrade and capacity expansion
3. Simpler system operation and maintenance
- After containerization, our development and test environments are highly consistent
4. Use computer resources more efficiently
- Docker is kernel-level virtualization that can run many container instances on a single machine!!
The basics of Docker
- Client: the Client
- DOCKER_HOST: the service side
- Containers, container
- Container: Docker uses container technology to run a single application or group of applications independently and create an image.
- Mirror Images:
- Image: Docker image is like a template that can be used to create container services. Redis image ==>run==> container (to provide services). Multiple containers can be created from this image (the final service or project is run in the container).
- Registry: warehouse
- Repository: A repository is a place where images are stored. The repository is divided into public and private repositories, docker Hub (default is foreign).
Install the Docker
If you don’t want to install it, you can use the online docker:labs.play-with-docker.com/
The installation of centos7 documentation docs.docker.com/engine/inst…
Here I use CentOS to demonstrate, Docker supports more versions
1. Uninstall the earlier version
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
Copy the code
2. Required installation package
sudo yum install -y yum-utils
Copy the code
3. Set the repository for the image
# default from abroad, download slow, suggest using the following link to sudo yum - config - manager - add - 'https://download.docker.com/linux/centos/docker-ce.repo # Configuration ali cloud docker mirror address sudo yum - config - manager - add - 'http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repoCopy the code
3.1. Update the package index
yum makecache fast
Copy the code
4. Install the docker
Docker-ce sudo yum install docker-ce docker-ce cli containerd.ioCopy the code
5. Start the docker
Docker version View the Docker versionCopy the code
6. Test Hello World
sudo docker run hello-world
Copy the code
7. View the downloaded image
docker image ls
Copy the code
8. Uninstall docker
sudo yum remove docker-ce docker-ce-cli containerd.io
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd
Copy the code