One, install, run, and configure docker
1. Docker installation
yum install -y docker
2. Check if docker is installed successfully
yum list installed |grep docker
Displaying this content indicates that the Docker installation was successful
3. Start the docker service (and set the boot to start automatically)
1、systemctl start docker.service
2、systemctl enable docker.service
4. View the docker service status
systemctl status docker
5. Restart the docker service
systemctl restart docker.service
Two, Docker commonly used commands
1. Docker container information query
// 查看docker容器版本
docker version
// 查看docker容器信息
docker info
// 查看docker容器帮助
docker --help
2. Docker image operation
- Mirror view
(1) View the list of Docker images
// 列出本地images
docker images
// 列出含中间映像层
docker images -a
(2) View the list of Docker image Id
// 只显示镜像ID
docker images -q
// 含中间映像层
docker images -qa
(3) View the Docker summary information list
// 显示镜像摘要信息(DIGEST列)
docker images --digests
// 显示镜像完整信息
docker images --no-trunc
(4) Display the historical creation of the Docker specified image
docker history -H 镜像名称(如redis)
The following is an example of redis mirroring, showing the results of the list
Parameter Description:
- -H Image size and date, the default is true;
- --no-trunc displays the complete submission record;
- -q lists only the submission record ID
- Docker image search
(1) Search the list of mirror warehouses (take redis as an example)
// 搜索仓库Redis镜像
docker search redis
Mirror search, you can filter the list of mirror warehouses. The author lists the corresponding filtering commands. The results are not repeated here. Interested readers can copy the commands to view
--过滤点赞数,只显示 starts>=500 的镜像列表
docker search --filter=stars=500 redis
// 显示镜像完整 DESCRIPTION 描述
docker search --no-trunc redis
// 只列出 AUTOMATED=OK 的镜像
docker search --automated redis
- Mirror download
// 下载Redis官方最新镜像(docker pull redis相当于 docker pull redis:latest)
docker pull redis
// 下载仓库所有Redis镜像
docker pull -a redis
// 下载私人仓库镜像
docker pull bitnami/redis
- Mirror deletion
// 单个镜像删除(docker rmi redis相当于docker rmi redis:latest)
docker rmi redis
// 强制删除(针对基于镜像有运行的容器进程)
docker rmi -f redis
// 多个镜像删除,不同镜像间以空格间隔
docker rmi -f redis redis mysql
// 删除本地全部镜像
docker rmi -f $(docker images -q)
- Image build
// 编写dockerfile
cd /docker/dockerfile
vim mycentos
// 构建docker镜像
docker build -f /docker/dockerfile/mycentos -t mycentos:1.1
Previous post: Docker learning (1): a basic introduction to Docker | Next: |
-------------------------------------------------- ----------------------
author: World coding
source: CSDN
original: https: //blog.csdn.net/dgxin_605/article/details/106165179
copyright notice : This article is the original article of the blogger, please attach a link to the blog post if you reprint it!
------------------------------------------------------------------------