资源链接
-
官方镜像仓库中查找tag
-
pull镜像(不指定tag时,默认tag为lastest)
docker pull nginx:1.20.2
-
启动镜像
docker create --name nginx -p 80:80 -p 443:443 \ -v /opt/data/nginx/config/nginx.conf:/etc/nginx/nginx.conf \ -v /opt/data/nginx/html/:/usr/share/nginx/html/ \ -v /opt/data/nginx/logs/:/var/log/nginx/ \ -v /opt/data/nginx/config/conf.d/default.conf:/etc/nginx/conf.d/default.conf \ -v /opt/data/nginx/ssl/:/etc/letsencrypt/live/chenchongyang.cn/ \ nginx:1.20.2
参数 说明 –name nginx 指定docker容器的名称,方便后续操作 -p 物理机端口:docker容器端口 物理机端口映射到docker容器中的端口 -v 物理机目录:docker容器目录 数据卷挂载位置,简而言之,就是docker容器实际读写的是物理机指定的文件 nginx:1.20.2 创建容器使用的镜像版本号