I am running docker and docker-compose on my arm64 mac and building one image for linux/amd64 target.
I run the following command:
docker buildx build -f /Users/k/Desktop/project/Dockerfile
--platform linux/amd64
--output type=docker
--build-arg BUILD_ENV=production
--build-arg NEWRELIC_LICENCE=magic
--pull
-t 2332.dkr.ecr.eu-central-1.amazonaws.com/project:prod-dfsksfdjkfdjfsdkjfsdk
/Users/k/Desktop/project
and do get this error:
#0 building with "desktop-linux" instance using docker driver
#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 516B done
#1 DONE 0.0s
#2 [internal] load metadata for docker.io/library/node:16.4.0-stretch-slim
#2 DONE 0.9s
#3 [internal] load .dockerignore
#3 transferring context: 116B done
#3 DONE 0.0s
#4 [base 1/4] FROM docker.io/library/node:16.4.0-stretch-slim@sha256:350b89f58a40081532c5183f25f1ecb6490cf060423a99570405b0535fc8894e
#4 CACHED
#5 [internal] load build context
#5 ...
#6 [base 2/4] RUN mkdir -p /usr/src/app
#6 ERROR: process "/bin/sh -c mkdir -p /usr/src/app" did not complete successfully: exit code: 1
#5 [internal] load build context
#5 transferring context: 13.12MB 0.2s done
#5 CANCELED
------
> [base 2/4] RUN mkdir -p /usr/src/app:
------
Dockerfile:5
--------------------
3 |
4 | # Set working directory
5 | >>> RUN mkdir -p /usr/src/app
6 | WORKDIR /usr/src/app
7 |
--------------------
ERROR: failed to solve: process "/bin/sh -c mkdir -p /usr/src/app" did not complete successfully: exit code: 1
This is my Dockerfile
:
# base image
FROM node:18.6.0-slim as base
# Set working directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
FROM base as dependencies
COPY . .
RUN yarn install
RUN yarn test
RUN yarn build
RUN rm -rf node_modules && yarn install --production
FROM base as production
COPY --from=dependencies /usr/src/app/node_modules ./node_modules
COPY --from=dependencies /usr/src/app/dist ./dist
CMD ["yarn", "start"]
The content of /Users/k/Desktop/project
is a very simple test project with a package.json and yarn.lock (nothing special)
Update:
I do comment the line 5 and then I get error in the line yarn install
without specific information..
Most of the commands inside Dockerfile seem to fail and exit with status code 1, without any further information to help me debug or troubleshoot.
How to investigate this further and solve the issue ?
2
Answers
🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯
I just upgraded docker-desktop in Mac LOOL and the issue resolved itself.
Keep in mind that I only installed docker for desktop YESTERDAY after the m1 was fully formatted and set-up...
It must be a bug. I have used this command a million times and never had an issue, have been hitting this in the past couple of days. May try a fresh install!