简体   繁体   English

Getting a hash value on creating a docker container without Dockerfile - php apache

[英]Getting a hash value on creating a docker container without Dockerfile - php apache

I have installed docker on my centos machine.我已经在我的 centos 机器上安装了 docker。 I am creating a container of php7.2 with apache from the official (without Dockerfile).我正在用官方的 apache 创建一个 php7.2 的容器(没有 Dockerfile)。 I am following the official site.我正在关注官方网站。

docker run -d -p 80:80 --name my-apache-php-app-final -v /var/www/html/project_name:/var/www/html php:7.2-apache

I am getting just this as the output.我得到的只是 output。 What am I doing wrong?我究竟做错了什么?

[root@driver-server php]# docker run -d -p 80:80 --name my-apache-php-app-final -v /var/www/html/project_name:/var/www/html php:7.2-apache
5f0df39bc64e80722f15968b1f5a24030ab9966e5fbed8261cf9664dd4522825
[root@driver-server php]#

Tried to get into the bash of the container but getting this error.试图进入容器的 bash 但收到此错误。

[root@driver-server php]# docker exec 5f0df39bc64e80722f15968b1f5a24030ab9966e5fbed8261cf9664dd4522825 bash
Error response from daemon: Container 5f0df39bc64e80722f15968b1f5a24030ab9966e5fbed8261cf9664dd4522825 is not running

May seem like an obvious thing to check but looking at the link, I would suggest making sure the Php code is in /var/www/html/project_name.检查似乎是一件显而易见的事情,但查看链接,我建议确保 Php 代码位于 /var/www/html/project_name 中。 Or better yet, run或者更好的是,运行

docker run -it -v /var/www/html/project_name:/var/www/html --entrypoint /bin/bash php:7.2-apache

Now use现在使用

ls -la $pwd

since the container shell Working directory is /var/www/html.因为容器 shell 工作目录是 /var/www/html。

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

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