Skip to content

Commit 1d3231d

Browse files
authored
docs: fixes to docker installation guide (#13847)
* docs: fixes to docker installation guide * more fixes * re-organize troubleshooting * add title
1 parent 7c31276 commit 1d3231d

File tree

3 files changed

+155
-11
lines changed

3 files changed

+155
-11
lines changed

www/apps/book/app/learn/installation/docker/page.mdx

Lines changed: 80 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ git clone https://github.com/medusajs/medusa-starter-default.git --depth=1 my-me
4343

4444
This command clones the repository into a directory named `my-medusa-store`.
4545

46+
Make sure to change into the newly created directory:
47+
48+
```bash
49+
cd my-medusa-store
50+
```
51+
52+
The rest of the steps will be performed inside this directory.
53+
4654
---
4755

4856
## 2. Create `docker-compose.yml`
@@ -96,8 +104,8 @@ services:
96104
env_file:
97105
- .env
98106
volumes:
99-
- .:/app
100-
- /app/node_modules
107+
- .:/server
108+
- /server/node_modules
101109
networks:
102110
- medusa_network
103111

@@ -238,7 +246,7 @@ WORKDIR /server
238246
COPY package.json package-lock.json ./
239247
240248
# Install all dependencies using npm
241-
RUN npm install
249+
RUN npm install --legacy-peer-deps
242250
243251
# Copy source code
244252
COPY . .
@@ -272,10 +280,30 @@ If you're using a different Yarn version, or you're using NPM, you need to insta
272280

273281
To install the dependencies, run the following command:
274282

275-
```bash npm2yarn
276-
npm install
283+
<CodeTabs group="npm2yarn">
284+
<CodeTab value="npm" label="npm">
285+
286+
```bash
287+
npm install --legacy-peer-deps
288+
```
289+
290+
</CodeTab>
291+
<CodeTab value="yarn" label="yarn">
292+
293+
```bash
294+
yarn install
277295
```
278296

297+
</CodeTab>
298+
<CodeTab value="pnpm" label="pnpm">
299+
300+
```bash
301+
pnpm install
302+
```
303+
304+
</CodeTab>
305+
</CodeTabs>
306+
279307
This will update `yarn.lock` or generate a `package-lock.json` file, depending on your package manager.
280308

281309
---
@@ -437,6 +465,53 @@ This command shows the logs of the `medusa` service, allowing you to see any err
437465

438466
---
439467

468+
## Troubleshooting
469+
470+
### start.sh Not Found Error
471+
472+
If you get the following error when starting the Medusa application with Docker:
473+
474+
```bash
475+
medusa_backend exited with code 127 (restarting)
476+
medusa_backend | /usr/local/bin/docker-entrypoint.sh: exec: line 11: ./start.sh: not found
477+
```
478+
479+
This is a common error for Windows users. It usually occurs when the `start.sh` file uses CRLF line endings instead of LF.
480+
481+
To fix this, ensure that the `start.sh` file uses LF line endings. You can configure Git to maintain LF line endings by following [this guide from GitHub](https://docs.github.com/en/get-started/git-basics/configuring-git-to-handle-line-endings).
482+
483+
### Couldn't Find X File or Directory Errors
484+
485+
If you encounter errors indicating that certain files or directories couldn't be found, make sure you're running the commands from the root directory of your Medusa application (the same directory where the `docker-compose.yml` file is located).
486+
487+
For example, if you run the `docker:up` command and see an error like this:
488+
489+
```bash
490+
error Couldn't find a package.json file in "/"
491+
```
492+
493+
Ensure that your terminal's current working directory is the root of your Medusa application, then try running the command again.
494+
495+
### Container Name Conflicts
496+
497+
If you're running multiple Medusa projects with Docker or have previously run this guide, you may encounter container name conflicts.
498+
499+
To resolve this, ensure that the `container_name` values in your `docker-compose.yml` file are unique for each project. You can modify them by appending a unique identifier to each name.
500+
501+
For example, change:
502+
503+
```yaml title="docker-compose.yml"
504+
container_name: medusa_postgres
505+
```
506+
507+
to
508+
509+
```yaml title="docker-compose.yml"
510+
container_name: medusa_postgres_myproject
511+
```
512+
513+
---
514+
440515
## Learn More about your Medusa Application
441516

442517
You can learn more about your Medusa application and its setup in the [Installation chapter](../page.mdx).

www/apps/book/generated/edit-dates.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export const generatedEditDates = {
123123
"app/learn/fundamentals/module-links/index/page.mdx": "2025-05-23T07:57:58.958Z",
124124
"app/learn/fundamentals/module-links/index-module/page.mdx": "2025-10-01T06:07:40.436Z",
125125
"app/learn/introduction/build-with-llms-ai/page.mdx": "2025-10-02T15:10:49.394Z",
126-
"app/learn/installation/docker/page.mdx": "2025-07-23T15:34:18.530Z",
126+
"app/learn/installation/docker/page.mdx": "2025-10-24T08:53:46.445Z",
127127
"app/learn/fundamentals/generated-types/page.mdx": "2025-07-25T13:17:35.319Z",
128128
"app/learn/introduction/from-v1-to-v2/page.mdx": "2025-09-29T15:33:38.811Z",
129129
"app/learn/debugging-and-testing/debug-workflows/page.mdx": "2025-07-30T13:45:14.117Z",

www/apps/book/public/llms-full.txt

Lines changed: 74 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22864,6 +22864,14 @@ git clone https://github.com/medusajs/medusa-starter-default.git --depth=1 my-me
2286422864

2286522865
This command clones the repository into a directory named `my-medusa-store`.
2286622866

22867+
Make sure to change into the newly created directory:
22868+
22869+
```bash
22870+
cd my-medusa-store
22871+
```
22872+
22873+
The rest of the steps will be performed inside this directory.
22874+
2286722875
***
2286822876

2286922877
## 2. Create `docker-compose.yml`
@@ -22917,8 +22925,8 @@ services:
2291722925
env_file:
2291822926
- .env
2291922927
volumes:
22920-
- .:/app
22921-
- /app/node_modules
22928+
- .:/server
22929+
- /server/node_modules
2292222930
networks:
2292322931
- medusa_network
2292422932

@@ -23050,7 +23058,7 @@ WORKDIR /server
2305023058
COPY package.json package-lock.json ./
2305123059

2305223060
# Install all dependencies using npm
23053-
RUN npm install
23061+
RUN npm install --legacy-peer-deps
2305423062

2305523063
# Copy source code
2305623064
COPY . .
@@ -23078,8 +23086,22 @@ If you're using a different Yarn version, or you're using NPM, you need to insta
2307823086

2307923087
To install the dependencies, run the following command:
2308023088

23081-
```bash npm2yarn
23082-
npm install
23089+
### npm
23090+
23091+
```bash
23092+
npm install --legacy-peer-deps
23093+
```
23094+
23095+
### yarn
23096+
23097+
```bash
23098+
yarn install
23099+
```
23100+
23101+
### pnpm
23102+
23103+
```bash
23104+
pnpm install
2308323105
```
2308423106

2308523107
This will update `yarn.lock` or generate a `package-lock.json` file, depending on your package manager.
@@ -23235,6 +23257,53 @@ This command shows the logs of the `medusa` service, allowing you to see any err
2323523257

2323623258
***
2323723259

23260+
## Troubleshooting
23261+
23262+
### start.sh Not Found Error
23263+
23264+
If you get the following error when starting the Medusa application with Docker:
23265+
23266+
```bash
23267+
medusa_backend exited with code 127 (restarting)
23268+
medusa_backend | /usr/local/bin/docker-entrypoint.sh: exec: line 11: ./start.sh: not found
23269+
```
23270+
23271+
This is a common error for Windows users. It usually occurs when the `start.sh` file uses CRLF line endings instead of LF.
23272+
23273+
To fix this, ensure that the `start.sh` file uses LF line endings. You can configure Git to maintain LF line endings by following [this guide from GitHub](https://docs.github.com/en/get-started/git-basics/configuring-git-to-handle-line-endings).
23274+
23275+
### Couldn't Find X File or Directory Errors
23276+
23277+
If you encounter errors indicating that certain files or directories couldn't be found, make sure you're running the commands from the root directory of your Medusa application (the same directory where the `docker-compose.yml` file is located).
23278+
23279+
For example, if you run the `docker:up` command and see an error like this:
23280+
23281+
```bash
23282+
error Couldn't find a package.json file in "/"
23283+
```
23284+
23285+
Ensure that your terminal's current working directory is the root of your Medusa application, then try running the command again.
23286+
23287+
### Container Name Conflicts
23288+
23289+
If you're running multiple Medusa projects with Docker or have previously run this guide, you may encounter container name conflicts.
23290+
23291+
To resolve this, ensure that the `container_name` values in your `docker-compose.yml` file are unique for each project. You can modify them by appending a unique identifier to each name.
23292+
23293+
For example, change:
23294+
23295+
```yaml title="docker-compose.yml"
23296+
container_name: medusa_postgres
23297+
```
23298+
23299+
to
23300+
23301+
```yaml title="docker-compose.yml"
23302+
container_name: medusa_postgres_myproject
23303+
```
23304+
23305+
***
23306+
2323823307
## Learn More about your Medusa Application
2323923308

2324023309
You can learn more about your Medusa application and its setup in the [Installation chapter](https://docs.medusajs.com/learn/installation/index.html.md).

0 commit comments

Comments
 (0)