您的当前位置:首页正文

docker下安装nginx

来源:华拓网

1:准备工作,一个docker环境的服务器,一个远程命令行工具

$ docker version
docker version

2:拉取docker-nginx镜像

docker pull nginx
docker pull nginx

查看镜像

docker images
docker images

3:启动nginx

docker run --name nginx -d -p 9000:80 -v /usr/local/nginx/html:/usr/share/nginx/html nginx

4:添加index.html

$ cd /usr/local/nnginx/html && touch index.html && vi index.html
# 向里面添加文字 hello nginx

hello nginx