strapi-community / strapi-tool-dockerize

Easy add support for docker to your strapi project
MIT License
504 stars 34 forks source link

The generated `docker-compose.yml` file can't be started on a DigitalOcean Droplet. #77

Closed akoskm closed 1 year ago

akoskm commented 1 year ago

🐛 Bug Report

The generated docker-compose.yml file can't be started on a fresh DigitalOcean Droplet.

🤷‍♀️ What did you do

Run locally npx @strapi-community/dockerize@latest -u, pushed the result to my strapi github repo. Logged in to the Droplet machine and created an .env file with the values from my local .env file. FYI the same error happens when I run locally docker-compose up.

⛔️ Error log

The command exited successfully. However, when I pulled the repo to a Digital Ocean droplet and ran docker-compose up this happened:

🕵️‍♀️ Stack trace

$ docker-compose up
Creating network "Innotek-strapi" with driver "bridge"
Creating volume "innotekdev-strapi_innotek-strapi-data" with default driver
Pulling innotek-strapiDB (postgres:14.5-alpine)...
14.5-alpine: Pulling from library/postgres
213ec9aee27d: Pull complete
40ab741cca09: Pull complete
c3636f308d36: Pull complete
ffb93d592d77: Pull complete
38e1167f56e0: Pull complete
5da721964db9: Pull complete
f4263eceafe0: Pull complete
b58169c5d1b0: Pull complete
Digest: sha256:ac09c433f64f2d310a83e5cc24dadc13561f645199d4ec8e503824de22e14668
Status: Downloaded newer image for postgres:14.5-alpine
Building innotek-strapi
[+] Building 21.5s (12/15)                                                                                                                                                                                         
 => [internal] load build definition from Dockerfile                                                                                                                                                          0.1s
 => => transferring dockerfile: 679B                                                                                                                                                                          0.0s
 => [internal] load .dockerignore                                                                                                                                                                             0.0s
 => => transferring context: 91B                                                                                                                                                                              0.0s
 => [internal] load metadata for docker.io/library/node:16-alpine                                                                                                                                             1.4s
 => [ 1/11] FROM docker.io/library/node:16-alpine@sha256:f1657204d3463bce763cefa5b25e48c28af6fe0cdb0f68b354f0f8225ef61be7                                                                                     4.2s
 => => resolve docker.io/library/node:16-alpine@sha256:f1657204d3463bce763cefa5b25e48c28af6fe0cdb0f68b354f0f8225ef61be7                                                                                       0.0s
 => => sha256:f1657204d3463bce763cefa5b25e48c28af6fe0cdb0f68b354f0f8225ef61be7 1.43kB / 1.43kB                                                                                                                0.0s
 => => sha256:710a2c192ca426e03e4f3ec1869e5c29db855eb6969b74e6c50fd270ffccd3f1 1.16kB / 1.16kB                                                                                                                0.0s
 => => sha256:8cf71856f96e5777c57c2318ecbcba52070b2c5a30c9a068db22a32f58a74c5c 6.49kB / 6.49kB                                                                                                                0.0s
 => => sha256:f56be85fc22e46face30e2c3de3f7fe7c15f8fd7c4e5add29d7f64b87abdaa09 3.37MB / 3.37MB                                                                                                                0.7s
 => => sha256:4e21e25411da70a575070bfdeb577f883468d985ed092cb6375617d9101cc0a3 36.63MB / 36.63MB                                                                                                              0.8s
 => => sha256:9890dc0be3454f96e39a7c5e623d4ff06b407048c719431df9e31332a596f52c 2.35MB / 2.35MB                                                                                                                0.9s
 => => extracting sha256:f56be85fc22e46face30e2c3de3f7fe7c15f8fd7c4e5add29d7f64b87abdaa09                                                                                                                     0.3s
 => => sha256:61d1890b04b02b1b0a3757f3cc69f63cda2ecf8fb2b29442750d79e9468a849e 449B / 449B                                                                                                                    0.9s
 => => extracting sha256:4e21e25411da70a575070bfdeb577f883468d985ed092cb6375617d9101cc0a3                                                                                                                     2.5s
 => => extracting sha256:9890dc0be3454f96e39a7c5e623d4ff06b407048c719431df9e31332a596f52c                                                                                                                     0.2s
 => => extracting sha256:61d1890b04b02b1b0a3757f3cc69f63cda2ecf8fb2b29442750d79e9468a849e                                                                                                                     0.0s
 => [internal] load build context                                                                                                                                                                             0.1s
 => => transferring context: 1.24MB                                                                                                                                                                           0.1s
 => [ 2/11] RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev                                                                                     13.2s
 => [ 3/11] RUN addgroup -g 1001 strapi && adduser -u 1001 -G strapi -s /bin/sh -D strapi                                                                                                                     0.6s
 => [ 4/11] WORKDIR /opt/                                                                                                                                                                                     0.1s 
 => [ 5/11] COPY package.json package-lock.json ./                                                                                                                                                            0.1s 
 => [ 6/11] RUN chown -R strapi:strapi /opt/                                                                                                                                                                  0.5s 
 => [ 7/11] COPY package.json package-lock.json ./                                                                                                                                                            0.1s 
 => ERROR [ 8/11] RUN npm config set network-timeout 600000 -g && npm install                                                                                                                                 1.3s 
------
 > [ 8/11] RUN npm config set network-timeout 600000 -g && npm install:
#0 1.230 npm ERR! code EACCES
#0 1.233 npm ERR! syscall mkdir
#0 1.236 npm ERR! path /usr/local/etc
#0 1.239 npm ERR! errno -13
#0 1.249 npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/etc'
#0 1.251 npm ERR!  [Error: EACCES: permission denied, mkdir '/usr/local/etc'] {
#0 1.253 npm ERR!   errno: -13,
#0 1.254 npm ERR!   code: 'EACCES',
#0 1.256 npm ERR!   syscall: 'mkdir',
#0 1.256 npm ERR!   path: '/usr/local/etc'
#0 1.256 npm ERR! }
#0 1.257 npm ERR! 
#0 1.258 npm ERR! The operation was rejected by your operating system.
#0 1.258 npm ERR! It is likely you do not have the permissions to access this file as the current user
#0 1.262 npm ERR! 
#0 1.262 npm ERR! If you believe this might be a permissions issue, please double-check the
#0 1.262 npm ERR! permissions of the file and its containing directories, or try running
#0 1.262 npm ERR! the command again as root/Administrator.
#0 1.262 
#0 1.262 npm ERR! A complete log of this run can be found in:
#0 1.262 npm ERR!     /home/strapi/.npm/_logs/2023-05-24T19_10_11_972Z-debug-0.log
------
Dockerfile:15
--------------------
  13 |     USER strapi
  14 |     COPY package.json package-lock.json ./
  15 | >>> RUN npm config set network-timeout 600000 -g && npm install
  16 |     
  17 |     WORKDIR /opt/app
--------------------
ERROR: failed to solve: process "/bin/sh -c npm config set network-timeout 600000 -g && npm install" did not complete successfully: exit code: 243
ERROR: Service 'innotek-strapi' failed to build : Build failed

🙇‍♀️ Expected behavior/code

docker-compose up to start the containers. Surprisingly this network-timeout command seems to be part of the initial commit, but I haven't found forums posts mentioning this issue.

👩‍💻 Environment

💡 Possible Solution

Run the command with sudo.

Eventyret commented 1 year ago

Will apply a hotfix for this @akoskm

Eventyret commented 1 year ago

:tada: This issue has been resolved in version 1.14.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

akoskm commented 1 year ago

Thanks, @Eventyret, for addressing this soo quickly. I tested the fix and it works 🚀