简体   繁体   English

当我使用 Docker 容器没有使用我的本地 html 文件时,我遇到了问题

[英]i have problem when i use Docker container is not using my local html file

First i create normal Docker file and used首先我创建正常的 Docker 文件并使用

FROM nginx:latest来自 nginx:最新

COPY.复制。 /usr/share/nginx/html /usr/share/nginx/html

inside Dockerfile内部 Dockerfile

it create images and containers perfectly它完美地创建图像和容器

but my friend by mistake write this in the terminal:但是我的朋友错误地在终端上写了这个:

docker run -d -p 80:80 docker/getting-started docker run -d -p 80:80 docker/getting-started

every time I create image or container will let me go to this website the first code i write after i delete the images and continers: docker build.每次我创建图像或容器时,都会让我 go 到这个网站,我在删除图像和 continers 后编写的第一个代码:docker build。

my image command: docker build -t image name.我的图像命令:docker build -t 图像名称。

my container command: docker run -d -p 80:80 Image ID我的容器命令:docker run -d -p 80:80 Image ID

note: the container was run my HTML file normal but my friend used that command I don't know why but I need to fix it i just want my container run my HTML file注意:容器运行我的 HTML 文件正常但我的朋友使用该命令我不知道为什么但我需要修复它我只想让我的容器运行我的 HTML 文件

code picture代码图片

The wrong website错误的网站

Stop the docker engine and remove all images and then built the image停止 docker 引擎并移除所有镜像,然后构建镜像

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何创建资金账户以使用我的本地 Nearup docker 容器进行开发 - how do I create a funded account to use my local nearup docker container for development 我可以将运行在Docker容器中的脚本输出作为本地文件夹吗? - Can I have an output of a script running in a Docker container as a local folder? 如何在容器上使用本地文件? - How can I use a local file on container? 当我重新启动 docker compose 时,Hashicorp Vault 容器不会将我的秘密保存在本地卷上 - Hashicorp Vault container don't save my secrets on local volume when I restart docker compose 当我用 docker 构建容器时,我看不到我的 html - I can't see my html when I built container with docker 当连接到 Docker 容器时,如何在 VS Code 中使用本地 git? - How do I use the local git in VS Code, when it is attached to a Docker container? docker 撰写我想使用我的本地目录 C:/html for /var/www/html - docker compose I want use my local directory C:/html for /var/www/html 如何将本地用户添加到我的 docker 容器? - How do I add the local users to my docker container? 如果我的主机有cuda 9,我可以将cuda 8放置在Docker容器中吗? - can i have docker container with cuda 8 if my host has cuda 9 gitlab在ci文件中使用Container Registry的链接时会提示找不到docker - gitlab when I use the link of Container Registry in the ci file, I will be prompted that the docker is not found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM