Introduction
Usually with Linux, I do not have a hard time regretting that Linux did not study well. Install some software with some environment is very afraid, thanks to the Docker. Docker is an application container engine that manages a lot of software images that are officially placed in the Docker Registories (Docker hub or Private warehouse). After downloading the image, you can run the build container directly and manage the container with a unified start and pause. Simplify the process of installing software, and realize the unified management of software environment.
Concept
Three core concepts of Docker: mirrors, containers, warehouses
Image images: Like a virtual machine image, as the saying goes is the installation file.
Container contains: Similar to a lightweight sandbox, where the container is creating an application run instance from the mirror,
You can start, start, stop, delete, and these containers are isolated from each other and are not visible to each other.
Warehouse Registories: Similar to the Code warehouse, is the place where Docker centrally stores image files.
Docker installation
Pre-conditions:
64-bit CENTOS7 System
Kernel 3.10+
1. Check the kernel version and return a value greater than 3.10.
$ uname -r
2. Log in to the terminal using sudo or root privileges.
3. Make sure Yum is up to date
$ yum update
4. Installing Docker
$ yum install -y docker
5. View the Docker version
$ docker -v
6. Start Docker
$ systemctl start docker
7. Set up the Docker service to start randomly
$ systemctl start docker
8.docker Stop of Service
$ systemctl stop docker
Docker Action on mirroring
1. Search for images
docker search image-name
2. Download the image
docker pull image-name:版本号
3. View existing Mirrors
docker images
4. Remove the image
docker rmi image_id
Docker operations on a container
1. Start the container
docker run --name yourname -d imagename:版本号
2. View containers
docker ps 查看启动中的容器docker ps -a 查看所有容器
3. Stop the container
docker stop contains_id
4. Start the container
docker start contains_id
5. Delete a container
docker rm contains_id
6. Production look at the container log
docker logs contains_id
Docker installs and starts the MySQL container
docker search mysqldocker pull mysqldocker run -e MYSQL_ROOT_PASSWORD=rootpassword -d -p 3306:3306 mysql:latest
Docker installs and launches Tomcat container
docker search tomcat docker pull tomcat docker run --name mytomcat01 -d -p 80:8080 tomcat docker cp chihaodian.war mytomcat01:/usr/local/tomcat/webapps
Docker first Experience-manage mysql+tomcat mirroring