简体   繁体   English

如何从Docker运行Apache服务器而不映射到位置?

[英]How to run Apache server from Docker without mapping to a location?

Docker Image: has apache; Docker Image:具有Apache; has an HTML file in the apache root. 在apache根目录中有一个HTML文件。

How can I access that file form the browser? 如何从浏览器访问该文件? (when I run the image) (当我运行图像时)

I tried: 我试过了:

docker run -d -p 8080:80 myimage/myimage

but when I do docker ps I see the port as 0.0.0.0:8080->80/tcp but I get HTTP ERROR 500 when opening 0.0.0.0:8080 or localhost:8080 . 但是当我执行docker ps我看到端口为0.0.0.0:8080->80/tcp但是打开0.0.0.0:8080localhost:8080时出现HTTP错误500。

Login in to docker container 登录到Docker容器

docker exec -it container_id /bin/bash

and start apache server if its not started. 并启动apache服务器(如果尚未启动)。

 service apache2 restart

Then from browser access using : http://localhost:8080 然后使用以下浏览器访问: http:// localhost:8080

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

相关问题 如何使用apache从Web服务器运行bash脚本? - How to run a bash script from a web server using apache? 从远程服务器连接到Docker中的Apache Web服务器 - Connecting to a Apache web server in a Docker from a remote server 如何在没有端口映射器的 Ubuntu Z05B60FC63C41A2130E6D945423F8E9496C429A5D8C65B4604FZ Z05B60FC63C41A2130E6D6D945423 服务器中运行 Ubuntu NFS V4 kernel 服务器? - How to run an Ubuntu NFS V4 kernel server in an Ubuntu docker instance without port mapper? 如何在Apache服务器上运行cakephp应用程序? [UBUNTU] - How to run a cakephp app on an apache server? [UBUNTU] 如何在 nixos 服务器上以声明方式运行 docker 容器? - How to run a docker container declaratively on nixos server? 在Docker中运行RabbitMQ服务器 - Run RabbitMQ server in Docker 从Docker容器内部运行dnsmasq作为DHCP服务器 - Run dnsmasq as DHCP server from inside a Docker container 如何在没有浏览器的情况下运行SWF(在Linux服务器上)? - How to run SWF without a browser (on a linux server)? 我如何在没有Docker的情况下(在基础系统上)运行Linux任务? - How do I run Linux tasks without Docker (on the underlying system)? 如何在不停止的情况下在 Docker 容器中运行 Nginx? - How to run Nginx within a Docker container without halting?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM