I am trying for so long to set up erpNext using docker on my laptop but could not
You can use below commands to install frappe/erpnext using docker. If you are using window then first install WSL and run these commands.
- Update the package index:
sudo apt-get update
- Download the Docker installation script:
curl -fsSL https://get.docker.com -o get-docker.sh
- Run the Docker installation script with the
--dry-run
flag to simulate the installation:
sudo sh ./get-docker.sh --dry-run
- Download the Docker installation script again:
curl -fsSL https://get.docker.com -o get-docker.sh
- Run the Docker installation script:
sudo sh get-docker.sh
- Add a
docker
group:
sudo groupadd docker
- Add your user to the
docker
group:
sudo usermod -aG docker $USER
- Activate the changes to group membership:
newgrp docker
- Run a test Docker container:
docker run hello-world
- Enable the Docker service:
sudo systemctl enable docker.service
- Enable the containerd service:
sudo systemctl enable containerd.service
- Set up Docker CLI plugins directory:
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
mkdir -p $DOCKER_CONFIG/cli-plugins
- Download Docker Compose binary to the CLI plugins directory:
curl -SL https://github.com/docker/compose/releases/download/v2.19.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
- Make the downloaded Docker Compose binary executable:
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
- Download Docker Compose binary to
/usr/local/bin
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
- Make the downloaded Docker Compose binary executable:
sudo chmod +x /usr/local/bin/docker-compose
- Verify Docker Compose installation:
docker-compose --version
Finally docker installation complete now we will do Frappe installation.
- Clone the Frappe Docker repository:
git clone https://github.com/frappe/frappe_docker.git
- Navigate into the cloned repository:
cd frappe_docker
- Copy the devcontainer-example directory to .devcontainer:
cp -R devcontainer-example .devcontainer
- Copy the vscode-example directory to .vscode:
cp -R development/vscode-example development/.vscode
- Install the Remote Containers extension for Visual Studio Code:
code --install-extension ms-vscode-remote.remote-containers
- Open the current directory in Visual Studio Code:
code .
NOTE
: here it will open vs code and it will show one popup like Open in Container , so click on this popup. then open terminal (CTRL+J) and run below command one by one
- Initialize a new Frappe bench with version 15:
bench init --skip-redis-config-generation --frappe-branch version-15 frappe-bench
- Move into the Frappe bench directory:
cd frappe-bench
- Set database host to MariaDB:
bench set-config -g db_host mariadb
- Set Redis cache host:
bench set-config -g redis_cache redis://redis-cache:6379
- Set Redis queue host:
bench set-config -g redis_queue redis://redis-queue:6379
- Set Redis socketio host:
bench set-config -g redis_socketio redis://redis-queue:6379
- Remove Redis from Procfile:
sed -i '/redis/d' ./Procfile
- Create a new site with specified passwords and configurations:
bench new-site --mariadb-root-password 123 --admin-password admin --no-mariadb-socket development.localhost
- Set root login and password for PostgreSQL:
bench config set-common-config -c root_login postgres
bench config set-common-config -c root_password '"123"'
- Enable developer mode and clear cache for the site:
bench --site development.localhost set-config developer_mode 1
bench --site development.localhost clear-cache
- Get the ERPNext app with version 15:
bench get-app --branch version-15 --resolve-deps erpnext
- Install the ERPNext app on the site:
bench --site development.localhost install-app erpnext
- Start the Frappe bench:
bench start