Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用Dockerfile将本地wp内容文件复制到Wordpress容器_Wordpress_Docker_Dockerfile - Fatal编程技术网

如何使用Dockerfile将本地wp内容文件复制到Wordpress容器

如何使用Dockerfile将本地wp内容文件复制到Wordpress容器,wordpress,docker,dockerfile,Wordpress,Docker,Dockerfile,我有一个Wordpress容器,我想在启动时将本地文件夹(带文件)复制到其中 我在文件夹中有本地文件: /html/wp-content/plugins /html/wp-content/themes /html/wp-content/uploads 我有一个Dockerfile,其中包含: FROM wordpress COPY ./html/wp-content/plugins/ /var/www/html/wp-content/plugins COPY ./html/wp-conten

我有一个Wordpress容器,我想在启动时将本地文件夹(带文件)复制到其中

我在文件夹中有本地文件:

/html/wp-content/plugins
/html/wp-content/themes
/html/wp-content/uploads
我有一个Dockerfile,其中包含:

FROM wordpress

COPY ./html/wp-content/plugins/ /var/www/html/wp-content/plugins
COPY ./html/wp-content/themes/ /var/www/html/wp-content/themes
COPY ./html/wp-content/uploads/ /var/www/html/wp-content/uploads

ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["apache2-foreground"]
尽管复制成功(生成通过),但这些文件并未显示在这些目标文件夹中

如果我将目标文件夹更改为在/html之前的任何路径上,例如,如果我将目标文件夹设置为/var或/var/www,那么文件将复制,并且我可以在容器中看到它们

我签出了,其中提到/html文件夹实际上是在启动时作为卷装入的,因此我需要先将文件复制到这个文件夹中

/usr/src/wordpress/wp-content
然后在启动时,这些文件夹将自动复制到/var/www/html/wp content/。(这可以解释为什么直接复制似乎不起作用)

我也试过了,虽然我的本地文件夹确实被复制到了这些文件夹中(我可以在容器中看到它们),但它们在启动时不会被复制到/var/www/html/content

  • 是否可以通过dockerfile将本地文件直接复制到/var/www/html文件夹中
  • 如果没有,我如何确保如果复制到/usr/src/wordpress/wp content,那么在启动时文件夹将被复制到/var/www/html/wp content/
  • (我看过的一些帖子不起作用,因为这似乎是Wordpress特有的,而不是Dockerfile副本:)

    在apache2.conf或其他配置文件的路径末尾贴了一句话“.放错了位置或没有放“/”