abiosoft / colima

Container runtimes on macOS (and Linux) with minimal setup
MIT License
17.73k stars 364 forks source link

permission denied when running image build locally #1050

Closed ranefattesingh closed 1 week ago

ranefattesingh commented 1 week ago

Description

I was running my Go project for doing integration test but everytime I run the image I am getting the permission denied error.

/bin/sh: 1: /bin/: Permission denied

Version

colima version 0.6.9
git commit: https://github.com/abiosoft/colima/commit/c3a31ed05f5fab8b2cdbae835198e8fb1717fd0f

runtime: docker
arch: aarch64
client: v26.1.4
server: v26.1.1

Operating System

Output of colima status

INFO[0000] colima is running using QEMU
INFO[0000] arch: aarch64
INFO[0000] runtime: docker
INFO[0000] mountType: 9p
INFO[0000] socket: unix:///Users/uname/.colima/default/docker.sock

Reproduction Steps

  1. docker build -t apitest
  2. docker run apitest OR docker run apitest:latest
  3. /bin/sh: 1: /bin/: Permission denied

Expected behaviour

docker run apitest should start container

Additional context

dockerfile used when building image

FROM golang:1.21.6-bookworm AS build

ARG app_name=myapp

RUN mkdir /app

ADD . /app

WORKDIR /app

ENV CGO_ENABLED=1

RUN go build -mod=vendor -buildvcs=true -ldflags '-linkmode=external' -o $app_name ./cmd/$app_name/

FROM golang:1.21.6-bookworm

ARG app_name=myapp

ENV APP_NAME=$app_name

COPY --from=build /app/$app_name /bin/$app_name

RUN chmod +x /bin/$app_name

EXPOSE 8080

ENTRYPOINT /bin/$app_name
ranefattesingh commented 1 week ago

found fix, it was due to entrypoint of the image hence closing this issue