yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum -y install docker-ce
systemctl start docker
vim /etc/docker/daemon.json
{ "registry-mirrors": ["https://xxxxx.mirror.aliyuncs.com"] }
systemctl daemon-reload
systemctl restart docker
docker search nginx
docker pull nginx:latest
docker images
docker run --name nginx-test -p 8080:80 -d nginx
命令参数说明:
docker search jdk
docker pull kdvolder/jdk8
docker run -di --name=jdk1.8 kdvolder/jdk8
docker exec -it jdk1.8 /bin/bash
docker search redis
docker pull redis:latest
docker run -itd --name redis-test -p 6379:6379 redis --requirepass 密码
# 进入镜像docker exec -it redis-test /bin/bash# 启动redisredis-cli# 输入密码auth 密码
docker search mysql
docker pull mysql:latest
docker run -itd --name mysql-test -p 3306:3306 -e MYSQL_ROOT_PASSWORD=cxy1120 mysql
# 进入镜像docker exec -it mysql-test /bin/bash# 启动mysqlmysql -h localhost -u root -p# 查询所有的数据库show databases
添加8080端口、3306端口、6379端口;保存即可生效