strapi-community / strapi-tool-dockerize

Easy add support for docker to your strapi project
MIT License
514 stars 35 forks source link

Platform flag issue #67

Closed mig-25 closed 1 year ago

mig-25 commented 1 year ago

πŸ› Bug Report

πŸ€·β€β™€οΈ What did you do

After installing Strapi via the cli tool, then I used your docker cli tool

⛔️ Error log

πŸ•΅οΈβ€β™€οΈ Stack trace

docker-compose up --build

[+] Building 67.3s (14/14) FINISHED                                                                                                 
 => [internal] load build definition from Dockerfile                                                                           0.0s
 => => transferring dockerfile: 483B                                                                                           0.0s
 => [internal] load .dockerignore                                                                                              0.0s
 => => transferring context: 86B                                                                                               0.0s
 => [internal] load metadata for docker.io/library/node:16-alpine                                                              1.8s
 => [auth] library/node:pull token for registry-1.docker.io                                                                    0.0s
 => [1/8] FROM docker.io/library/node:16-alpine@sha256:b4a72f83f52bbe3970bb74a15e44ec4cf6e873ad4787473dfc8a26f5b4e29dd2        1.4s
 => => resolve docker.io/library/node:16-alpine@sha256:b4a72f83f52bbe3970bb74a15e44ec4cf6e873ad4787473dfc8a26f5b4e29dd2        0.0s
 => => sha256:b6f9bace56ac362c7806f8deeb90f266845dfec935bcdccac803e5daf2f0ef20 36.49MB / 36.49MB                               0.7s
 => => sha256:babb9645c565e97a1a59e05a5a9be53810876a2c2464d1a54027e634152c8149 2.41MB / 2.41MB                                 0.2s
 => => sha256:b4a72f83f52bbe3970bb74a15e44ec4cf6e873ad4787473dfc8a26f5b4e29dd2 1.43kB / 1.43kB                                 0.0s
 => => sha256:0ac2f8cba4274f3aeeb8dd2cde7714fe746b917df68a79eb9b4d5de053c5aa53 1.16kB / 1.16kB                                 0.0s
 => => sha256:5b6b1b14e0516d9de0a964a1e3022e17d517539b3e37082478f7adcaf1e2af95 6.50kB / 6.50kB                                 0.0s
 => => sha256:c41833b44d910632b415cd89a9cdaa4d62c9725dc56c99a7ddadafd6719960f9 3.26MB / 3.26MB                                 0.3s
 => => sha256:014e873a0e36f8b98976f2e7ba1c884d1655cfef237b9bb9c4916bc9acf1557e 449B / 449B                                     0.7s
 => => extracting sha256:c41833b44d910632b415cd89a9cdaa4d62c9725dc56c99a7ddadafd6719960f9                                      0.1s
 => => extracting sha256:b6f9bace56ac362c7806f8deeb90f266845dfec935bcdccac803e5daf2f0ef20                                      0.5s
 => => extracting sha256:babb9645c565e97a1a59e05a5a9be53810876a2c2464d1a54027e634152c8149                                      0.1s
 => => extracting sha256:014e873a0e36f8b98976f2e7ba1c884d1655cfef237b9bb9c4916bc9acf1557e                                      0.0s
 => [internal] load build context                                                                                              0.0s
 => => transferring context: 455.35kB                                                                                          0.0s
 => [2/8] RUN apk update && apk add  build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev                   5.3s
 => [3/8] WORKDIR /opt/                                                                                                        0.0s
 => [4/8] COPY ./package.json ./yarn.lock ./                                                                                   0.0s
 => [5/8] RUN yarn config set network-timeout 600000 -g && yarn install                                                       39.1s
 => [6/8] WORKDIR /opt/app                                                                                                     0.0s
 => [7/8] COPY ./ .                                                                                                            0.0s
 => [8/8] RUN yarn build                                                                                                      13.3s
 => exporting to image                                                                                                         6.2s
 => => exporting layers                                                                                                        6.2s
 => => writing image sha256:56a04d197d2f3543fa9b5a1dbfe3262f6e67039e535a594a987b8a4b06c78f7a                                   0.0s
 => => naming to docker.io/library/mystrapi:latest                                                                             0.0s
[+] Running 0/1
 β ‹ Container strapiDB  Creating                                                                                                0.0s
Error response from daemon: image with reference postgres:12.0-alpine was found but does not match the specified platform: wanted linux/amd64, actual: linux/arm64

## πŸ™‡β€β™€οΈ Expected behavior/code

I used the 
`docker-compose up -d
`
and it gave me the same error, what am I doing wrong? I have not changed anything in the docker compose file, specially the platform data.
Just building the docker file with `docker build --platform linux/amd64  .` created the image
And running the docker file with `docker run 200e7c496425 --platform linux/amd64  .`  gave me the following error: WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8)
## πŸ‘©β€πŸ’» Environment

- πŸ“¦ Node version: v18.15.0
- πŸ’» OS:  macOS 13.3.1 (22E261)
-CPU: Apple M1 Max

## πŸ’‘ Possible Solution

<!-- Only if you have suggestions on a fix for the bug -->

## πŸ“Ί Additional context/Screenshots

<!-- Add any other context about the problem here. If applicable, add screenshots to help explain. -->
Eventyret commented 1 year ago
Error response from daemon: image with reference postgres:12.0-alpine was found but does not match the specified platform: wanted linux/amd64, actual: linux/arm64

So might be worth check the compose file It seems you might need to adjust the compose file ☺️

mig-25 commented 1 year ago

I changed the image to run:

image: postgres:12.0

and that seems to make it work :)

Eventyret commented 1 year ago

Glad to hear it works fine :) Will close the issue then.