How to install and use docker on the cloud server

1. Why use docker

Personally think that docker deployment is simple and flexible, does not require us to configure the environment, it has an independent operating environment, which can greatly save our time
2)

Second, install docker on the cloud server

System: centos7
1) Some basic commands of docker

//要求系统内核在3.10版本以上,检查内核
uname -r
//安装命令
yum install docker
//启动docker
systemctl start docker
//设置开机自启
systemctl enable docker
//停止docker
systemctl stop docker

2) Container operation commands

//查看本地所有docker镜像
docker images
//所有docker镜像 例:docker search mysql
docker search 关键字
//拉取镜像 例:docker pull mysql:5.5
docker pull 镜像名:tag 
//删除镜像
docker rmi 镜像id
//根据镜像启动容器(-d代表后台运行)
docker run --name mytomcat -d tomcat:latest
//停止运行中的镜像
docker stop 容器id
//查看所有容器
docker ps -a
//查看运行中的容器
docker ps
//启动容器
docker start 容器id
//删除容器
docker rm 容器id
//端口映射 将主机端口映射到容器的一个端口 主机:容器
-p 8888:8080 

3) Alibaba Cloud image acceleration
https://help.aliyun.com/document_detail/60750.html
Insert picture description here

Published 12 original articles · Liked3 · Visits 407

Guess you like

Origin blog.csdn.net/Hobo_hua/article/details/104854347