赞
踩
cat /etc/centos-release
,至少要centos7以上,因Docker要求yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo
yum makecache fast
yum -y install docker-ce
docker version
systemctl enable docker
systemctl start docker
docker run hello-world
docker pull rancher/rancher:stable
docker inspect rancher/rancher:stable
,查看Volumes标签和ExposedPorts标签(用于看需暴露的端口),在本地创建目录来外挂,经检查需新建4个目录mkdir -p /docker_volume/rancher_home/rancher \
&& mkdir -p /docker_volume/rancher_home/cni \
&& mkdir -p /docker_volume/rancher_home/kubelet \
&& mkdir -p /docker_volume/rancher_home/log
docker run -d --privileged --restart=unless-stopped \
-p 8080:80 -p 8443:443 \
-v /docker_volume/rancher_home/rancher:/var/lib/rancher \
-v /docker_volume/rancher_home/cni:/var/lib/cni \
-v /docker_volume/rancher_home/kubelet:/var/lib/kubelet \
-v /docker_volume/rancher_home/log:/var/log \
--name rancher rancher/rancher:stable
docker logs -ft --tail -F xxxx(容器id)
,跟踪报错情况docker images
查看拉取的镜像,docker ps
查看运行了多个容器docker pull jenkins/jenkins:alpine
docker inspect jenkins/jenkins:alpine
,查看Volumes标签和ExposedPorts标签(用于看需暴露的端口),在本地创建目录来外挂,经检查需新建1个目录,mkdir -p /docker_volume/jenkins_home
chown -R 1000:1000 /docker_volume/jenkins_home
,这一条是看dockerFile得出的结果cat /docker_volume/jenkins_home/secrets/initialAdminPassword
docker pull mysql:5.7
docker inspect mysql:5.7
,查看Volumes标签和ExposedPorts标签(用于看需暴露的端口),在本地创建目录来外挂,需新建1个目录mkdir -p /docker_volume/mysql/data
MYSQL_ROOT_PASSWORD
,值是123456--character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
docker pull redis:6.2-alpine
docker inspect redis:6.2-alpine
,查看Volumes标签和ExposedPorts标签(用于看需暴露的端口),在本地创建目录来外挂,需新建1个目录mkdir -p /docker_volume/redis/data
redis-server --appendonly yes
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。