What is Docker?
Docker is an open platform for developing, publishing, and running applications. Docker enables you to decouple your application from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure just like your applications. By leveraging Docker's approach to delivering, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production.
What is dockerfile?
Docker can automatically build an image by reading the instructions in dockerfile. Dockerfile is a text file used to build an image, and the text content contains an instruction and description required to build an image.
What is docker compose?
Docker compose is a tool used to help define and share multi container applications. With compose, we can create a yaml file to define services, and with a command or operation, we can start all contents or close them all.
Install in the left menu "Docker" interface
The interface after installation is as follows:
Product function list and detailed explanation
Docker images are the foundation of containers. A image has no state, it never changes.
A container is a running instance of a Docker image.
Compose is a tool for defining and running complex applications using Docker.
- Compose template
Compose Template Defines the yaml files that make up a Compose project.
Container networking is part of the virtual environment created by Docker for containers, allowing containers to be independent from the host's network environment.
A volume is a specially designated directory within one or more containers. A volume is intended for data persistence, independent of the container's lifecycle. So when a container is deleted, Docker never automatically deletes the volume.
Repositories are used to store Docker images.
Status of the Docker service.
image interface preview:
pull image: pull images from Docker official repository and third-party repository
Pull the image from the official docker repository: mysql:5.7
mysql:5.7 Explanation; mysql is the name of the image, 5.7 is the label, separated by English ":"
Pull images from third-party repositories: registry.cn-shenzhen.aliyuncs.com/star7th/showdoc
Explanation: The name of the third-party repository/user/image, no label defaults to: latest
Import image: import image from this server
Build image: build image from Dockerfile
View the example of building an image: Click me to go directly to the Dockerfile to build an image example
View the example of building an image:Click me to go directly to the Dockerfile to build an image example
Push: push the image to the specified repository
Note: You need to set up your own repository before you can push
Label filling format: image name:label, the image name must be the same as the repository name to be pushed normally. As shown in the figure:
Export: export the image to this server
Del: delete the image, It cannot be restored after deleting the image, please pay attention to the relevant backup
ID: sha256 fingerprint information of the image, which is also the ID of the image
Image name: the name and label of the image, the unique identifier of the Docker image, if the "build/import image" has the same "image name: label", it will overwrite the old image
size: the size of the image
Creation time: the time the image was created
Container interface preview:
Add container: create container from image, create container from Compose template
Example:use the "mysql:5.7" image as an example to create a container
Containers are generally created from the command line like this:
docker run -d --name mysql_test -p 3361:3306 -v /docker/mysql_data/:/var/lib/mysql/ -e MYSQL_ROOT_PASSWORD=my-passwd mysql:5.7
- run: create a container using the mysql:5.7 image
- -d: the container runs in the background
- --name: Set the container name: mysql_test
- -p 3361:3306: Map host 3361 port to container 3306 port
- -v /docker/mysql_data/:/var/lib/mysql/: Map the host /docker/mysql_data/ directory to the container /var/lib/mysql/ directory for data persistence (if the host directory does not exist will be created automatically)
- -e: MYSQL_ROOT_PASSWORD=my-passwd: Specify the environment variable and set the MySQL root user password to my-passwd. If this environment variable is not specified in the mysql image, the container will not be able to run
Containers can be created in the panel like this:
- Name: corresponding to --name, fill in the container name
- Image: select mysql:5.7 to create a container
- Port: corresponding to -p 3361:3306 , note: After filling in, click the + icon to take effect.
- Command: can be left blank
- Automatically delete the container after the container stops: After the container is stopped, the container will be automatically deleted. Please note that the data backup cannot be restored after deletion
- Limit CPU, Memory : limit the resources used by the container
- Volume: corresponding to -v /docker/mysql_data/:/var/lib/mysql/ , you can also add and select the volume name in the "volume interface" for data persistence, note: After filling in, click the + icon to take effect.
- Tag: used to identify the purpose of the container, can be left blank
- Env variable: corresponding to -e MYSQL_ROOT_PASSWORD=my-passwd
- Restart rules:
- Not restart: restarting the server/restarting the Docker service does not start the container
- Rest up immediately after closing: restart the server / restart the Docker service to automatically start the container
- Restart at the time of error (restart 5 times by default): The container will restart when an error occurs, and it will not restart after more than 5 times. Please check the container log to troubleshoot errors
- The panel already runs in the background using run -d by default
- How to use the public image container, please check its official information
Stats: Real-time monitoring of the container CPU, memory, hard disk IO, network IO resource usage
Terminal: Enter the container in terminal mode
Note: The container needs to be in the startup state to enter the container, otherwise it will exit to the host machine
Path: enter the container directory through the File manager
Log: View the running log of the container
Del: delete the container, The data cannot be recovered after the container is deleted. Please pay attention to the data backup. If the container has data persistence, the volume will not be been deleted
Container name: Can click into it to use the "Container Configuration" and "Generate Image" functions
(1) Container configuration: Click "Container Name" to view the container configuration, and click "…" to view more configurations
(2) Generate mirror image: Generate mirror image of the current container, Export the compressed package after the image is generated
Status: Optionally start, stop, pause, unpause, restart, reload container
image: the image used by the container
IP: IP address of the container
CPU usage: CPU usage of the container
Port (host-->container): the port that the host is mapped to the container, the left is the host
Start time: the time when the container was started for the first time
Execite: Select 1 or more to perform batch operations on containers: start, stop, pause, unpause, restart, reload, delete containers
Compose interface preview:
Add Compose project: build container from Compose template
Check out the Docker Compose example:Click me directly to the Docker Compose example
(1) Compose operation: Can choose to start, stop, pause, unpause, and restart the entire Compose project
(2) Status: Can choose to start, stop, pause, unpause, restart, and reload the container
(3) Terminal: Enter the container in terminal mode
(4) Path: Enter the container directory through the File manager
(5) Log: View the running log of the container
(6) Del: delete a single container, The data cannot be recovered after deletion, please pay attention to the data backup, if the container has data persistence, the volume will not been deleted
Del: delete the container of the entire Compose project, will delete all the containers in the project, the data cannot be restored after deletion, please pay attention to the data backup, if the container There is data persistence, the volume will not be deleted
project name: Compose project name
Number of containers: The number of containers within the project
Startup time: The time when the container was started for the first time
Description: Used to describe the usefulness of this project
Execite: select 1 or more project for batch operation: delete Compose project
Fourth, Compose template
Compose template interface preview:
Add: add Compose template, search local template
Edit: Edit Compose template
Pull image: pull the image according to the configuration of the Compose template
Del: Delete the Compose template, It cannot be restored after deletion, please pay attention to the backup of the template content
Template name: the name of the template
Path: The storage path of the template
Description: Used to describe the usefulness of this template
Execite: select 1 or more templates for batch operation: delete Compose template
Web interface preview:
Add network: Add new network to Docker
Del: delete the container network
Network Name: The name of the network
Show: network driver type
(1) none: none mode does not use the network
(2) host: host mode directly uses the host's network
(3) bridge: bridge mode is bridged with the host, the default network used by the container
Network number: IP range of the container network
Gateway: Gateway IP address of the container network subnet
Tag: used to identify the usefulness of the container network
Creation time: The time when the container network was created
Execite: select 1 or more networks for batch operation: delete network
Volume interface preview:
Add Volume: Add a new volume
Can add a volume first, and then go to the Add Container interface to select volume
Del: delete the volume, The data cannot be recovered after deleting the volume, please pay attention to the data backup
Volume name: the name of the volume where the container data is persisted
Mount point: the path stored in the host
Name: which container is currently name using this volume
Device: The device where the volume is stored
Creation time: The time when the volume was created
Tag: used to identify the usefulness of the volume
Execite: Select one or more volumes to perform batch operations: delete the volume, The data cannot be recovered after deleting the volume, please pay attention to the data backup
Repository interface preview:
Add Repository: add docker official library, third-party Repository
The official docker library is added as follows:
Edit: Edit repository
Del: delete repository
URL: images repository link
Username: login repository user
Repository name: repository name/image name
Description: Used to identify the usefulness of the repository
Execite: select 1 or more repository for batch operation: delete repository
Setting interface preview:
Docker service: The current Docker service status, start, restart, and stopp. After the Docker service is started, whether the container is started according to the restart rules
Container monitor: on, off. CPU usage will no longer be monitored after shutdown
Save days:: Set the monitoring storage days of the container page. Default is 30 days
Registry URL: Set the acceleration URL. After setting the acceleration, you need to restart Docker manually.
If you encounter problems or have good suggestions during use, please open a new thread or leave a message under this thread