Building a website into nginx container

How can I copy files into the /config/www and preserve the directory tree?

I’m trying to build a “custom” nginx image with a web app already integrated but for some reason every time I run the image, all the files in /config/www are listed as one instead of whatever subfolder the files were supposed to be in.

If I do a RUN ls -la /config/www in the dockerfile, it looks correct. When I run the docker-compose file then grab a shell and check the directory, it is not. I don’t get it, what’s happening?


FROM linuxserver/nginx

ADD filethingy.tar.bz2 /config/www/


version: '3'

      container_name: filethingy
      hostname: filethingy
      image: jms1989/filethingy
      restart: always
        - PUID=1000
        - PGID=1000
        - TZ=America/Chicago
        - 8080:80
        - 8443:443
        - ./config/nginx:/config/nginx
        - ./config/php:/config/php
        - ./config/keys:/config/keys
        - ./config/log:/config/log

host: linux mint, docker: v19.03.6, docker-compose v1.17.1

Just put your web app in any non-existent location inside the image (ie. /my-app), then map a custom default site conf to /defaults/default and set the root directive to /my-app

or look into how we handle web apps based on our nginx baseimage like librespeed:

I figured it out. Turns out the docker build command wasn’t overwriting the first built image apparently. Not sure why. Once I deleted the old image and rebuilt it, everything worked properly.

Semi-related: is it possible to specify a php memory limit as a environment variable in the docker-compose file?

Not as env variable, but you can either sed the php.ini in your dockerfile, or edit the php-local.ini file i n the config folder