yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce
systemctl start docker
docker search mysql
进入docker hub的官网,地址为:https://hub.docker.com,然后搜索需要的镜像
image-20200810135719724
image-20200810135737004
docker pull mysql:5.7
docker images
docker run -p 3306:3306 --name mysql -d mysql:5.7
docker ps
docker ps -a
docker stop containerName(containerId)
例如:docker stop mysql or docker stop b417ac5a44b0
docker kill containerName(containerId)
例如:docker kill mysql or docker kill b417ac5a44b0
docker start containerName(container)
例如:docker start mysql docker start b417ac5a44b0
docker inspect --format '{{ .NetworkSettings.IPAddress }}' containerName(containerId)
docker container update --restart=always $ContainerName
docker run -p 80:80 --name nginx \ -e TZ="Asia/Shanghai" \ -d nginx:1.17.0
docker stats -a
docker exec -it $ContainerName /bin/bash
docker network create -d bridge my-bridge-network
docker info | grep "Docker Root Dir"
systemctl stop docker
mv /var/lib/docker /mydata/docker
ln -s /mydata/docker /var/lib/docker