Hi, I have been trying to setup a local krayin using the docker config provided on https://devdocs.krayincrm.com/2.0/introduction/docker.html#introduction and https://github.com/krayin/krayin-docker/tree/main.
I have got the files setup in a directory with the compose.yaml, Dockerfile, setup.sh and relevant .config files in the .config directory.
I can build the docker images fine if i run docker compose up however when I run the setup.sh script i get the following output.
❯ ./setup.sh
Removing network krayin_test_default
WARNING: Network krayin_test_default not found.
Removing volume krayin_test_mysql-data
WARNING: Volume krayin_test_mysql-data not found.
krayin-mysql uses an image, skipping
Building krayin-php-apache
[+] Building 0.5s (27/27) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.56kB 0.0s
=> [internal] load metadata for docker.io/library/node:22.9 0.4s
=> [internal] load metadata for docker.io/library/php:8.3-apache 0.4s
=> [internal] load metadata for docker.io/library/composer:2.7 0.4s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [stage-0 1/18] FROM docker.io/library/php:8.3-apache@sha256:7a3fd6ae9c9d240810bae95d3aaf894be4f0ec1a022b0a5f129d658a625e2ac2 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 70B 0.0s
=> FROM docker.io/library/composer:2.7@sha256:cb3483dc851665462a66c59982577dfbbde0ae2059e8b5550c2f49f44b8c333e 0.0s
=> FROM docker.io/library/node:22.9@sha256:8398ea18b8b72817c84af283f72daed9629af2958c4f618fe6db4f453c5c9328 0.0s
=> CACHED [stage-0 2/18] RUN apt-get update && apt-get install -y git ffmpeg libfreetype6-dev libicu-dev libgmp-dev libjpeg62-turbo-dev libpng-dev 0.0s
=> CACHED [stage-0 3/18] RUN docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp 0.0s
=> CACHED [stage-0 4/18] RUN docker-php-ext-configure intl 0.0s
=> CACHED [stage-0 5/18] RUN docker-php-ext-install bcmath calendar exif gd gmp intl mysqli pdo pdo_mysql zip 0.0s
=> CACHED [stage-0 6/18] COPY --from=composer:2.7 /usr/bin/composer /usr/local/bin/composer 0.0s
=> CACHED [stage-0 7/18] COPY --from=node:22.9 /usr/local/lib/node_modules /usr/local/lib/node_modules 0.0s
=> CACHED [stage-0 8/18] COPY --from=node:22.9 /usr/local/bin/node /usr/local/bin/node 0.0s
=> CACHED [stage-0 9/18] RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm 0.0s
=> CACHED [stage-0 10/18] RUN npm install -g npx 0.0s
=> CACHED [stage-0 11/18] RUN npm install -g laravel-echo-server 0.0s
=> CACHED [stage-0 12/18] WORKDIR /var/www/html/ 0.0s
=> CACHED [stage-0 13/18] RUN useradd -G www-data,root -u 1000 -d /home/alex alex 0.0s
=> CACHED [stage-0 14/18] RUN mkdir -p /home/alex/.composer && chown -R alex:alex /home/alex 0.0s
=> CACHED [stage-0 15/18] COPY ./.configs/apache.conf /etc/apache2/sites-available/000-default.conf 0.0s
=> CACHED [stage-0 16/18] RUN a2enmod rewrite 0.0s
=> CACHED [stage-0 17/18] RUN chmod -R 775 /var/www/html/ 0.0s
=> CACHED [stage-0 18/18] RUN chown -R alex:www-data /var/www/html/ 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:46cdbb41e246045935e91856a6442143e1539d75c3a2e2944d0a6098f08e0dad 0.0s
=> => naming to docker.io/library/krayin-php-apache 0.0s
Creating network "krayin_test_default" with the default driver
Creating volume "krayin_test_mysql-data" with default driver
Creating krayin_test_krayin-mysql_1 ... done
Creating krayin_test_krayin-php-apache_1 ... done
Please wait... Waiting for MySQL connection...
Creating empty database for krayin...
Creating empty database for krayin testing...
Now, setting up Krayin...
fatal: could not create work tree dir 'krayin': Permission denied
Now, setting up Krayin stable version...
bash: line 1: cd: krayin: No such file or directory
bash: line 1: cd: krayin: No such file or directory
lstat /home/alex/SourceCode/krayin_test/.configs/.env: no such file or directory
lstat /home/alex/SourceCode/krayin_test/.configs/.env.testing: no such file or directory
sh: 1: cd: can't cd to krayin
I believe the issue is due to the user in the compose.yaml not being correct however it isn't clear what it should be. User id 1000 is my host machines user id, but does there need to be a www-data user and have userid be set to that? Any help would be appreciated.
Here are my compose.yaml and Dockerfile
compose.yaml (I removed phpmyadmin as I don't need it):
services:
krayin-php-apache:
build:
args:
container_project_path: /var/www/html/
uid: 1000 # add your uid here
user: $USER
context: .
dockerfile: ./Dockerfile
image: krayin-php-apache
ports:
- 80:80 # adjust your port here, if you want to change
volumes:
- ./workspace/:/var/www/html/
krayin-mysql:
image: mysql:8.0
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_HOST: '%'
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306 # adjust your port here, if you want to change
volumes:
- ./.configs/mysql-data:/var/lib/mysql/
volumes:
mysql-data:
Dockerfile:
# main image
FROM php:8.3-apache
# installing dependencies
RUN apt-get update && apt-get install -y
git
ffmpeg
libfreetype6-dev
libicu-dev
libgmp-dev
libjpeg62-turbo-dev
libpng-dev
libwebp-dev
libxpm-dev
libzip-dev
unzip
zlib1g-dev
# configuring php extension
RUN docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp
RUN docker-php-ext-configure intl
# installing php extension
RUN docker-php-ext-install bcmath calendar exif gd gmp intl mysqli pdo pdo_mysql zip
# installing composer
COPY --from=composer:2.7 /usr/bin/composer /usr/local/bin/composer
# installing node js
COPY --from=node:22.9 /usr/local/lib/node_modules /usr/local/lib/node_modules
COPY --from=node:22.9 /usr/local/bin/node /usr/local/bin/node
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm
# installing global node dependencies
RUN npm install -g npx
RUN npm install -g laravel-echo-server
# arguments
ARG container_project_path
ARG uid
ARG user
# setting work directory
WORKDIR $container_project_path
# adding user
RUN useradd -G www-data,root -u $uid -d /home/$user $user
RUN mkdir -p /home/$user/.composer &&
chown -R $user:$user /home/$user
# setting apache
COPY ./.configs/apache.conf /etc/apache2/sites-available/000-default.conf
RUN a2enmod rewrite
# setting up project from src
folder
RUN chmod -R 775 $container_project_path
RUN chown -R $user:www-data $container_project_path
# changing user
USER $user