简体   繁体   English

无法访问安装在ubuntu docker容器中的xampp htdocs中的文件

[英]Not able to access files in xampp htdocs installed in ubuntu docker container

I have installed xampp and deployed my php code in a docker image and started a container on ubuntu 14.04. 我已经安装了xampp并将php代码部署在docker映像中,并在ubuntu 14.04上启动了一个容器。

I cannot access my phpmyadmin by using my docker container system ip/phpmyadmin in host computer's firefox browser , but cannot take my web interface in browser. 我无法在主机的firefox浏览器中使用docker容器系统ip / phpmyadmin访问我的phpmyadmin,但无法在浏览器中使用我的Web界面。 while try to access my web interface its shows as follows: 尝试访问我的Web界面时,其显示如下:

Access forbidden!

You don't have permission to access the requested object. bhla bhla....
Error 403

Note: I have already given required permissions to files in xampp/htdocs folder 注意:我已经授予了xampp / htdocs文件夹中文件的必需权限

Running a new container with sudo docker run -ti ubuntu will not bind any port. 使用sudo docker run -ti ubuntu运行新容器不会绑定任何端口。 The option -p needs to be used to bind host-port from container-port. 需要使用-p选项来将主机端口与容器端口绑定。

See a more detailed answer . 查看更详细的答案

In your case, assuming your web server is running on port 80 in the container and assuming you cant to access it from you host web browser on the port 9090 start the container with the command: 在您的情况下,假设您的Web服务器在容器的端口80上运行,并且假定您无法从端口9090上的宿主Web浏览器访问它,请使用以下命令启动容器:

docker run -it -p 9090:80 ubuntu

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM