skip to Main Content

I’m trying to build a medusajs Docker image.

I followed all the steps in the quick start guide, but when doing sudo docker compose up --build in the root folder of the project, I receive the following error:

Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "~/medusaPR/micruniverse-store-engine/develop.sh": stat ~/medusaPR/micruniverse-store-engine/develop.sh: no such file or directory: unknown

Edit: This is the output after making those corrections to the publication of the Dockerfiles and the docker-compose, now for the new errors, can you point me in the right direction pls? From what I can see, all the steps of the build are complete, but then at the end when executing seems to be missing files or permission.

Sorry for the inconvenience, thanks for your great assistance 😀

random0perator@random0perator:~/medusaPR/micruniverse-store-engine$ sudo docker compose up --build
[+] Building 5.1s (39/39) FINISHED                                                                                                          
 => [storefront:test internal] load build definition from Dockerfile                                                                   0.0s
 => => transferring dockerfile: 32B                                                                                                    0.0s
 => [backend:test internal] load build definition from Dockerfile                                                                      0.0s
 => => transferring dockerfile: 32B                                                                                                    0.0s
 => [admin:test internal] load build definition from Dockerfile                                                                        0.1s
 => => transferring dockerfile: 32B                                                                                                    0.0s
 => [storefront:test internal] load .dockerignore                                                                                      0.1s
 => => transferring context: 2B                                                                                                        0.0s
 => [admin:test internal] load .dockerignore                                                                                           0.1s
 => => transferring context: 2B                                                                                                        0.0s
 => [backend:test internal] load .dockerignore                                                                                         0.1s
 => => transferring context: 34B                                                                                                       0.0s
 => [admin:test internal] load metadata for docker.io/library/node:latest                                                              0.8s
 => [backend:test internal] load metadata for docker.io/library/node:17.1.0                                                            0.0s
 => [backend:test internal] load build context                                                                                         0.0s
 => => transferring context: 4.62kB                                                                                                    0.0s
 => [backend:test 1/9] FROM docker.io/library/node:17.1.0                                                                              0.0s
 => CACHED [backend:test 2/9] WORKDIR /app/medusa                                                                                      0.0s
 => CACHED [backend:test 3/9] COPY package.json .                                                                                      0.0s
 => CACHED [backend:test 4/9] RUN apt-get update                                                                                       0.0s
 => CACHED [backend:test 5/9] RUN apt-get install -y python                                                                            0.0s
 => CACHED [backend:test 6/9] RUN npm install -g npm@latest                                                                            0.0s
 => CACHED [backend:test 7/9] RUN npm install -g @medusajs/medusa-cli@latest                                                           0.0s
 => CACHED [backend:test 8/9] RUN npm install --loglevel=error                                                                         0.0s
 => CACHED [backend:test 9/9] COPY . .                                                                                                 0.0s
 => [admin:test] exporting to image                                                                                                    0.1s
 => => exporting layers                                                                                                                0.0s
 => => writing image sha256:19d5d8cb37b3e0a9fd95f01c0afaa2862872a3cc68522504afd349bca4f18290                                           0.0s
 => => naming to docker.io/library/backend:test                                                                                        0.0s
 => => writing image sha256:2b8d52804d62799a489c22e732cc79dd805ea0e82e1b66f1ed022c77e9e85164                                           0.0s
 => => naming to docker.io/library/storefront:test                                                                                     0.0s
 => => writing image sha256:0ae7ad72057373eb371b515ebd55b4536ef97b0e4d809abf99c57ef9f8499dc4                                           0.0s
 => => naming to docker.io/library/admin:test                                                                                          0.0s
 => [storefront:test  1/10] FROM docker.io/library/node:latest@sha256:ebd1096a66c724af78abb11e6c81eb05b85fcbe8920af2c24d42b6df6aab268  0.0s
 => [admin:test internal] load build context                                                                                           4.0s
 => => transferring context: 8.40MB                                                                                                    3.5s
 => [storefront:test internal] load build context                                                                                      2.9s
 => => transferring context: 5.91MB                                                                                                    2.8s
 => CACHED [storefront:test 2/9] WORKDIR /app/storefront                                                                               0.0s
 => CACHED [storefront:test 3/9] COPY . .                                                                                              0.0s
 => CACHED [storefront:test 4/9] RUN rm -rf node_modules                                                                               0.0s
 => CACHED [storefront:test 5/9] RUN apt-get update                                                                                    0.0s
 => CACHED [storefront:test 6/9] RUN npm install -g npm@latest                                                                         0.0s
 => CACHED [storefront:test 7/9] RUN npm install -g gatsby-cli                                                                         0.0s
 => CACHED [storefront:test 8/9] RUN npm install sharp                                                                                 0.0s
 => CACHED [storefront:test 9/9] RUN npm install --loglevel=error                                                                      0.0s
 => CACHED [admin:test  2/10] WORKDIR /app/admin                                                                                       0.0s
 => CACHED [admin:test  3/10] COPY . .                                                                                                 0.0s
 => CACHED [admin:test  4/10] RUN rm -rf node_modules                                                                                  0.0s
 => CACHED [admin:test  5/10] RUN apt-get update                                                                                       0.0s
 => CACHED [admin:test  6/10] RUN npm install -g npm@latest                                                                            0.0s
 => CACHED [admin:test  7/10] RUN npm install sharp                                                                                    0.0s
 => CACHED [admin:test  8/10] RUN npm install -g gatsby-cli                                                                            0.0s
 => CACHED [admin:test  9/10] RUN npm install --loglevel=error                                                                         0.0s
 => CACHED [admin:test 10/10] RUN npm run build &> /dev/null                                                                           0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
[+] Running 5/0
 â ¿ Container medusapr-postgres-1  Created                                                                                              0.0s
 â ¿ Container cache                Created                                                                                              0.0s
 â ¿ Container medusa-server        Created                                                                                              0.0s
 â ¿ Container medusa-storefront    Created                                                                                              0.0s
 â ¿ Container medusa-admin         Created                                                                                              0.0s
Attaching to cache, medusa-admin, medusa-server, medusa-storefront, medusapr-postgres-1
cache                | 1:C 30 Jul 2022 20:37:21.835 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
cache                | 1:C 30 Jul 2022 20:37:21.837 # Redis version=7.0.4, bits=64, commit=00000000, modified=0, pid=1, just started
cache                | 1:C 30 Jul 2022 20:37:21.838 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
cache                | 1:M 30 Jul 2022 20:37:21.844 * monotonic clock: POSIX clock_gettime
cache                | 1:M 30 Jul 2022 20:37:21.848 * Running mode=standalone, port=6379.
cache                | 1:M 30 Jul 2022 20:37:21.849 # Server initialized
cache                | 1:M 30 Jul 2022 20:37:21.850 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
cache                | 1:M 30 Jul 2022 20:37:21.853 * Loading RDB produced by version 7.0.4
cache                | 1:M 30 Jul 2022 20:37:21.853 * RDB age 24 seconds
cache                | 1:M 30 Jul 2022 20:37:21.853 * RDB memory usage when created 0.82 Mb
cache                | 1:M 30 Jul 2022 20:37:21.854 * Done loading RDB, keys loaded: 0, keys expired: 0.
cache                | 1:M 30 Jul 2022 20:37:21.854 * DB loaded from disk: 0.001 seconds
cache                | 1:M 30 Jul 2022 20:37:21.854 * Ready to accept connections
medusapr-postgres-1  | 2022-07-30 20:37:21.962 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
medusapr-postgres-1  | 2022-07-30 20:37:21.962 UTC [1] LOG:  listening on IPv6 address "::", port 5432
medusapr-postgres-1  | 2022-07-30 20:37:22.105 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
medusapr-postgres-1  | 2022-07-30 20:37:22.446 UTC [23] LOG:  database system was shut down at 2022-07-30 20:36:57 UTC
medusapr-postgres-1  | 2022-07-30 20:37:22.505 UTC [1] LOG:  database system is ready to accept connections
medusa-server        | medusa develop
medusa-server        | 
medusa-server        | Start development server. Watches file and rebuilds when something changes
medusa-server        | 
medusa-server        | Options:
medusa-server        |   --verbose                Turn on verbose output  [boolean] [default: false]
medusa-server        |   --no-color, --no-colors  Turn off the color in output  [boolean] [default: false]
medusa-server        |   --json                   Turn on the JSON logger  [boolean] [default: false]
medusa-server        |   -H, --host               Set host. Defaults to localhost  [string] [default: "localhost"]
medusa-server        |   -p, --port               Set port. Defaults to 9000 (set by env.PORT) (otherwise defaults 9000)  [string] [default: "9000"]
medusa-server        |   -h, --help               Show help  [boolean]
medusa-server        |   -v, --version            Show the version of the Medusa CLI and the Medusa package in the current project  [boolean]
medusa-server        | babel:
medusa-server        |   src does not exist
medusa-server        | Error: Command failed: "/app/medusa/node_modules/.bin/babel" src -d dist
medusa-server        |     at checkExecSyncError (node:child_process:826:11)
medusa-server        |     at execSync (node:child_process:900:15)
medusa-server        |     at /app/medusa/node_modules/@medusajs/medusa/dist/commands/develop.js:82:42
medusa-server        |     at step (/app/medusa/node_modules/@medusajs/medusa/dist/commands/develop.js:33:23)
medusa-server        |     at Object.next (/app/medusa/node_modules/@medusajs/medusa/dist/commands/develop.js:14:53)
medusa-server        |     at /app/medusa/node_modules/@medusajs/medusa/dist/commands/develop.js:8:71
medusa-server        |     at new Promise (<anonymous>)
medusa-server        |     at __awaiter (/app/medusa/node_modules/@medusajs/medusa/dist/commands/develop.js:4:12)
medusa-server        |     at default_1 (/app/medusa/node_modules/@medusajs/medusa/dist/commands/develop.js:74:12)
medusa-server        |     at /usr/local/lib/node_modules/@medusajs/medusa-cli/dist/create-cli.js:260:7 {
medusa-server        |   status: 2,
medusa-server        |   signal: null,
medusa-server        |   output: [ null, null, null ],
medusa-server        |   pid: 13,
medusa-server        |   stdout: null,
medusa-server        |   stderr: null
medusa-server        | }
medusa-server exited with code 0
medusa-storefront    | 
medusa-storefront    |  ERROR
medusa-storefront    | 
medusa-storefront    | gatsby develop
medusa-storefront    | 
medusa-storefront    | Start development server. Watches files, rebuilds, and hot reloads if something
medusa-storefront    | changes
medusa-storefront    | 
medusa-storefront    | Options:
medusa-storefront    |   --verbose                   Turn on verbose output  [boolean] [default: false]
medusa-storefront    |   --no-color, --no-colors     Turn off the color in output  [boolean] [default:
medusa-storefront    | false]
medusa-storefront    |   --json                      Turn on the JSON logger  [boolean] [default:
medusa-storefront    | false]
medusa-storefront    |   -H, --host                  Set host. Defaults to localhost  [string]
medusa-storefront    | [default: "localhost"]
medusa-storefront    |   -p, --port                  Set port. Defaults to 8000  [string] [default:
medusa-storefront    | "8000"]
medusa-storefront    |   -o, --open                  Open the site in your (default) browser for you.
medusa-storefront    | [boolean]
medusa-storefront    |   -S, --https                 Use HTTPS. See
medusa-storefront    | https://www.gatsbyjs.com/docs/local-https/ as a guide  [boolean]
medusa-storefront    |   -c, --cert-file             Custom HTTPS cert file (also required: --https,
medusa-storefront    | --key-file). See https://www.gatsbyjs.com/docs/local-https/  [string] [default:
medusa-storefront    | ""]
medusa-storefront    |   -k, --key-file              Custom HTTPS key file (also required: --https,
medusa-storefront    | --cert-file). See https://www.gatsbyjs.com/docs/local-https/  [string] [default:
medusa-storefront    |  ""]
medusa-storefront    |   --ca-file                   Custom HTTPS CA certificate file (also required:
medusa-storefront    | --https, --cert-file, --key-file).  See
medusa-storefront    | https://www.gatsbyjs.com/docs/local-https/  [string] [default: ""]
medusa-storefront    |   --graphql-tracing           Trace every graphql resolver, may have performance
medusa-storefront    |  implications  [boolean] [default: false]
medusa-storefront    |   --open-tracing-config-file  Tracer configuration file (OpenTracing
medusa-storefront    | compatible). See https://gatsby.dev/tracing  [string]
medusa-storefront    |   --inspect                   Opens a port for debugging. See
medusa-storefront    | https://www.gatsbyjs.com/docs/debugging-the-build-process/  [number]
medusa-storefront    |   --inspect-brk               Opens a port for debugging. Will block until
medusa-storefront    | debugger is attached. See
medusa-storefront    | https://www.gatsbyjs.com/docs/debugging-the-build-process/  [number]
medusa-storefront    |   -h, --help                  Show help  [boolean]
medusa-storefront    |   -v, --version               Show the version of the Gatsby CLI and the Gatsby
medusa-storefront    | package in the current project  [boolean]
medusa-storefront    | 

medusa-storefront    |  ERROR
medusa-storefront    | 
medusa-storefront    | gatsby <develop> can only be run for a gatsby site.
medusa-storefront    | Either the current working directory does not contain a valid package.json or
medusa-storefront    | 'gatsby' is not specified as a dependency
medusa-storefront    | 
medusa-storefront    | 
medusa-storefront exited with code 1
medusa-admin         | 
medusa-admin         |  ERROR
medusa-admin         | 
medusa-admin         | Initiated Worker with invalid NODE_OPTIONS env variable:
medusa-admin         | --openssl-legacy-provider is not allowed in NODE_OPTIONS
medusa-admin         | 

medusa-admin         | 
medusa-admin         |   Error: Initiated Worker with invalid NODE_OPTIONS env variable: --openssl-lega
medusa-admin         |   cy-provider is not allowed in NODE_OPTIONS
medusa-admin         |   
medusa-admin         |   - errors:387 new NodeError
medusa-admin         |     node:internal/errors:387:5
medusa-admin         |   
medusa-admin         |   - worker:195 new Worker
medusa-admin         |     node:internal/worker:195:13
medusa-admin         |   
medusa-admin         |   - ThreadsWorker.js:51 ThreadsWorker.start
medusa-admin         |     [admin]/[@parcel]/workers/lib/threads/ThreadsWorker.js:51:19
medusa-admin         |   
medusa-admin         |   - Worker.js:104 Worker.fork
medusa-admin         |     [admin]/[@parcel]/workers/lib/Worker.js:104:23
medusa-admin         |   
medusa-admin         |   - WorkerFarm.js:232 WorkerFarm.startChild
medusa-admin         |     [admin]/[@parcel]/workers/lib/WorkerFarm.js:232:12
medusa-admin         |   
medusa-admin         |   - WorkerFarm.js:394 WorkerFarm.startMaxWorkers
medusa-admin         |     [admin]/[@parcel]/workers/lib/WorkerFarm.js:394:14
medusa-admin         |   
medusa-admin         |   - WorkerFarm.js:139 new WorkerFarm
medusa-admin         |     [admin]/[@parcel]/workers/lib/WorkerFarm.js:139:10
medusa-admin         |   
medusa-admin         |   - Parcel.js:565 createWorkerFarm
medusa-admin         |     [admin]/[@parcel]/core/lib/Parcel.js:565:10
medusa-admin         |   
medusa-admin         |   - Parcel.js:232 Parcel._init
medusa-admin         |     [admin]/[@parcel]/core/lib/Parcel.js:232:20
medusa-admin         |   
medusa-admin         |   - Parcel.js:273 Parcel.run
medusa-admin         |     [admin]/[@parcel]/core/lib/Parcel.js:273:7
medusa-admin         |   
medusa-admin         |   - compile-gatsby-files.ts:67 compileGatsbyFiles
medusa-admin         |     [admin]/[gatsby]/src/utils/parcel/compile-gatsby-files.ts:67:29
medusa-admin         |   
medusa-admin         |   - initialize.ts:172 initialize
medusa-admin         |     [admin]/[gatsby]/src/services/initialize.ts:172:3
medusa-admin         |   
medusa-admin         | 
not finished compile gatsby files - 0.308s
medusa-admin         | 
medusa-admin exited with code 1

2

Answers


  1. I reviewed your Dockerfile:

    FROM node:17.1.0
    
    WORKDIR ~/medusaPR/micruniverse-store-engine
    
    COPY package.json ./
    
    RUN apt-get update
    RUN apt-get install -y python
    
    RUN npm install -g npm@latest
    RUN npm install -g @medusajs/medusa-cli@latest
    RUN npm install --loglevel=error
    
    COPY . .
    
    ENTRYPOINT ["./develop.sh", "develop"]
    

    … and most of the instructions look alright to me. Your entrypoint is being properly copied in. What is odd, however, is your ENTRYPOINT instruction:

    ENTRYPOINT ["./develop.sh", "develop"]
    

    Referencing the documentation on ENTRYPOINT, we can see that your Dockerfile is using the exec form:

    ENTRYPOINT ["executable", "param1", "param2"]
    

    … which means that your develop.sh is your executable and develop is a parameter to it. However, if we take a look at develop.sh, we can see that it does not take parameters. It already has the "develop" parameter:

    #!/bin/bash
    
    #Run migrations to ensure the database is updated
    medusa migrations run
    
    #Start development environment
    medusa develop
    

    So maybe change your ENTRYPOINT to: ENTRYPOINT ["./develop.sh"] to fix the problem?


    Also a second possible cause, based on my own earlier comment:

    If this dockerfile is from the backend folder, it MUST be built within the backend folder, not some "root" directory above it.

    The build context sent to Docker determines what files are available
    to COPY when you use relative references, for example: COPY ./ ./. If
    you’re trying to build your image from a parent directory, without
    adjusting your dockerfile or build arguments, then that’s probably why
    your build is failing.

    Your Dockerfile can’t copy develop.sh into the image because its not in the parent directory; it’s in the backend child directory.

    Login or Signup to reply.
  2. Just run this command will format the .sh file correctly.

    dos2unix.exe your-file.sh

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search