Docker

#1
I'm learning / testing about Docker and would like to run OLS as a container. I'm using Ubuntu 24 LTS with Docker 29.02.

If I run this command the container starts and I can get to the Webadmin page on port 7080
Code:
docker run --name openlitespeed -d -p 7080:7080 -p 80:80 -p 443:443 -it litespeedtech/openlitespeed:1.8.4-lsphp84
However, when I try to start OLS via docker compose, I can't access anything and
Code:
docker logs litespeed
shows the error:
Code:
Can't determine the Home of LiteSpeed Web Server, exit!
[ERROR] Failed to start litespeed!
The OLS section of my compose file is below. I've based it on the OLS Env Github example
Code:
    litespeed:
        image: "litespeedtech/openlitespeed:${OLS_VERSION}-${PHP_VERSION}"
        restart: unless-stopped
        container_name: litespeed
        env_file:
            - .env
        volumes:
            - ./lsws/conf:/usr/local/lsws/conf
            - ./lsws/admin-conf:/usr/local/lsws/admin/conf
            - ./sites:/var/www/vhosts/
            - ./logs:/usr/local/lsws/logs/
        environment:
            TZ: ${TimeZone}
        networks:
            - public
            - private
I'm obviously missing something but I don't know what to check next. If it helps, the project is under /opt/docker/dockertest - could it be permissions related? However ./logs/lsrestart.log is being written to:
Code:
Thu Nov 27 21:53:04 GMT 2025
start, LSWS running: 0
LSWS does not restart properly, check port 7080
check port 7080 after kill all litespeed processes
Thu Nov 27 21:53:21 GMT 2025
status, LSWS running: 0
Thu Nov 27 21:53:22 GMT 2025
start, LSWS running: 0
LSWS does not restart properly, check port 7080
check port 7080 after kill all litespeed processes
Thu Nov 27 21:53:39 GMT 2025
status, LSWS running: 0
Thu Nov 27 21:53:39 GMT 2025
start, LSWS running: 0
LSWS does not restart properly, check port 7080
check port 7080 after kill all litespeed processes
Thu Nov 27 21:53:56 GMT 2025
status, LSWS running: 0
Thu Nov 27 21:53:56 GMT 2025
start, LSWS running: 0
Thank you in advance!

{Edit}
I've just had a thought that as I'm mapping in the volumes for conf, sites etc via docker compose, the conf folders are empty and thus I now think that is why OLS can't start (as these exist when running the image "directly"). However, if you are starting with a docker image from scratch (with mounted volumes), how do you start the image to configure it? Something of a chicken and egg situation...
 
#3
Thank you for your help. Before going to bed last night I was digging through the OLS Dockerfile repo and looked at the entrypoint.sh script.

https://github.com/litespeedtech/ols-dockerfiles

I realised that if conf or admin-conf are empty, the script will copy in files from the relevant .conf folder, so OLS can start (thus answering my question on chicken & egg). This morning I was trying to figure out why that wasn't happening but was hampered as the container would keep restarting when OLS failed to start and thus keep kicking me out of a shell session. After a number of very short sessions, I figured out that I am the problem. :rolleyes:

Whilst building my project folder structure, I'd put a .gitkeep file in ./lsws/conf and ./lsws/admin-conf to maintain the folder structure whilst they were empty. These were being mounted into the container, so entrypoint.sh script wasn't seeing an empty folder and quite correctly not copying in the essential files...

Once I removed the .gitkeep, OLS started first time. Amazing :ROFLMAO: A little knowledge is a dangerous thing!
 
Top