docker pull 一个lnmp的镜像下来安装 怎么修改他的配置 比如说我要给php 加个扩展 nginx 修改点域名之类的
高洛峰2017-04-25 09:03:58
Use commands like docker run -it -u root 镜像名 /bin/bash
to change it
After making the changesexit
Exit
Thendocker commit <container ID> 新的镜像名
submit your image
大家讲道理2017-04-25 09:03:58
It is recommended to use the configuration file in the form of a data volume and replace the original configuration in the container, including the PHP extension. You can create a new temporary container, compile the extension and export it to the host, and then mount it into the lnmp container through mounting. In the directory, just specify the corresponding directory and file in the configuration of php.ini.
It is not recommended to modify the configuration after entering the container and then submit it. The process of modifying the configuration again is very cumbersome.
某草草2017-04-25 09:03:58
It is recommended that you repackage the new image based on it, and modify or overwrite the original configuration file.
Example:
FROM nginx:latest
ADD . /opt/flask/
RUN cp /opt/flask/flask.conf /etc/nginx/nginx.conf
VOLUME ["/opt/flask/media"]
VOLUME ["/opt/flask/static"]
EXPOSE 80