linkstack-docker icon indicating copy to clipboard operation
linkstack-docker copied to clipboard

Can't bind the /htdocs folder to outside of container

Open jccbbb opened this issue 1 year ago • 2 comments

Hello,

I want to do some theme development and therefor being able to have the docker image up and running while editing my theme in /themes.

However I can't manage to bind the /htdocs in the docker container to the project folder i am using in WSL2.

Can anyone provide steps how to get access to this so I can open up the theme in an IDE?

jccbbb avatar Mar 05 '24 23:03 jccbbb

I am also unable to set up permanent storage. I can set up the /tmp directory, but not /htdocs. I have also tried to set UMASK PUID and PGID. Without success.

derpieler avatar Apr 29 '24 19:04 derpieler

I have a workaround. Here are the steps I used.

Step 1: Launch the docker container with persistent docker volume:

services:
    linkstack:
        depends_on:
          - db
        image: 'linkstackorg/linkstack:latest'
        volumes:
          - linkstack_data:/htdocs
        environment:
          - TZ=Asia/Singapore
          - SERVER_ADMIN=
          - HTTP_SERVER_NAME=
          - HTTPS_SERVER_NAME=
          - LOG_LEVEL=info
          - PHP_MEMORY_LIMIT=512M
          - UPLOAD_MAX_FILESIZE=48M
        restart: always
        ports:
            - '80:80'

    db:
        image: mysql:8.0.24
        volumes:
          - ./db:/var/lib/mysql
        restart: always
        environment:
          MYSQL_ROOT_PASSWORD: 
          MYSQL_DATABASE:
          MYSQL_USER:
          MYSQL_PASSWORD: 
        security_opt:
          - seccomp:unconfined

volumes:
  linkstack_data:

Step 2: Find the location of the persistent storage within docker, do a sudo cp -rfp sudo cp -rfp /var/lib/docker/volumes/<volume>/_data <location on local disk>

Step 3: Update the docker-compose.yml with local persistent storage:

services:
    linkstack:
        depends_on:
          - db
        image: 'linkstackorg/linkstack:latest'
        volumes:
          - <location of folder copied from step 2>:/htdocs
        environment:
          - TZ=Asia/Singapore
          - SERVER_ADMIN=
          - HTTP_SERVER_NAME=
          - HTTPS_SERVER_NAME=
          - LOG_LEVEL=info
          - PHP_MEMORY_LIMIT=512M
          - UPLOAD_MAX_FILESIZE=48M
        restart: always
        ports:
            - '80:80'

    db:
        image: mysql:8.0.24
        volumes:
          - ./db:/var/lib/mysql
        restart: always
        environment:
          MYSQL_ROOT_PASSWORD: 
          MYSQL_DATABASE:
          MYSQL_USER:
          MYSQL_PASSWORD: 
        security_opt:
          - seccomp:unconfined

maya329 avatar Jul 27 '24 19:07 maya329