2017-11-25 231 views
0

我有兩個docker鏡像:php和phantomjs。我使用它們來構建簡單的命令行腳本應用程序。 也即時有方便run.bat腳本,其中包含:在另一個docker鏡像(php,nodejs,phantomjs)中使用單命令docker鏡像

docker run -it --rm --name my-running-script -v %cd%:/usr/src/myapp -w /usr/src/myapp php:7.0-cli php 我該怎麼做才能將nodejs添加到我的php圖像? 我希望能夠在php容器內使用諸如「phantomjs --help」之類的東西。

我試着搜索類似問題的文檔,但沒有找到任何提示。

這是使用即時通訊phantomjs圖像:https://hub.docker.com/r/wernight/phantomjs/ PHP的圖像即時通訊使用: https://hub.docker.com/_/php/

回答

1

如果你想你的PHP容器內phantomjs,而不是使用兩個搬運工圖像一個與php和其他與phantomjs你只需要用這兩個軟件包構建自己的cutom docker鏡像。

看來你正在使用debian:stretch作爲基礎圖像phantomjshttps://hub.docker.com/r/wernight/phantomjs/~/dockerfile/

你只需要谷歌在Debian安裝PHP。可能它應該在dockerfile apt-get install -y php中多出一行。然後建立這個圖像並使用它。