Docker部署静态Html文件

编程

Create Dockerfile

FROM nginx:alpine

COPY . /usr/share/nginx/html

Build Docker Image

 docker build -t webserver-ng:v1 .

注意最后的点,表示,运行当前目录的Dockerfile

查看创建的镜像

docker images

Run

docker run -d -p 80:80 webserver-ng:v1

00b517fda698cb5ca8c1391f711032c4f6cdbfbbfb2e105180f9db5c66cf9e3e

docker ps

CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS                NAMES

00b517fda698 webserver-ng:v1 "nginx -g "daemon of…" About a minute ago Up About a minute 0.0.0.0:80->80/tcp angry_montalcini

http://localhost/index.html

Reference

eploy Static HTML Website as Container

以上是 Docker部署静态Html文件 的全部内容, 来源链接: utcz.com/z/516235.html

回到顶部