小编mai*_*man的帖子

如何将多行附加到dockerfile中的文件?

我有一个 dockerfile,似乎无法将 nginx 配置文件嵌入其中,因此可以将其附加到 /etc/nginx/nginx.conf。

我尝试了以下格式:

RUN cat <<EOT >> /etc/nginx/nginx.conf
user                            www;
worker_processes                auto; # it will be determinate automatically by the number of core

error_log                       /var/log/nginx/error.log warn;
pid                             /var/run/nginx.pid; # it permit you to use /etc/init.d/nginx reload|restart|stop|start

events {
    worker_connections          1024;
}

http {
    include                     /etc/nginx/mime.types;
    default_type                application/octet-stream;
    sendfile                    on;
    access_log                  /var/log/nginx/access.log;
    keepalive_timeout           3000;
    server {
        listen                  80;
        root                    /usr/local/www;
        index                   index.html index.htm;
        server_name             localhost;
        client_max_body_size    32m;
        error_page              500 502 503 504  /50x.html;
        location = /50x.html {
              root …
Run Code Online (Sandbox Code Playgroud)

bash docker centos7 dockerfile

10
推荐指数
1
解决办法
4356
查看次数

标签 统计

bash ×1

centos7 ×1

docker ×1

dockerfile ×1