Home > Back-end >  Docker container can't find file
Docker container can't find file

Time:01-04

Github repo here.

I have a runshortcuts.sh bash script I set up to deploy different parts of my app for dev or prod. I can run it from the project's root directory with ./runshortcuts.sh $args. I mapped the root of my project directory to /usr/src/app and verified with ls that the project root directories look the same on my machine and in the container.

For whatever reason I can't execute runshortcuts.sh from within the docker container and get "OCI runtime exec failed: exec failed: unable to start container process: exec ./runshortcuts.sh: no such file or directory: unknown". Its permissions are -rwxrwxr-x according to ls -l. Wrapping it in a sh also fails as sh can't find the file. I am clueless as to why this is, any ideas?

I'm using the node 14-alpine base image. My Docker setup is quite minimal:

Dockerfile:

FROM node:14-alpine
WORKDIR /usr/src/app
VOLUME /usr/src/app

docker-compose.yaml:

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "3000:3000"
      - "5000:5000"
    volumes:
      - .:/usr/src/app
    tty: true

When I docker-compose up -d and docker ps -a I see:

CONTAINER ID   IMAGE               COMMAND                  CREATED             STATUS                  PORTS                                                                                NAMES
bdaac49268d0   fiction-forge_app   "docker-entrypoint.s…"   About a minute ago   Up 5 seconds   0.0.0.0:3000->3000/tcp, :::3000->3000/tcp, 0.0.0.0:5000->5000/tcp, :::5000->5000/tcp   fiction-forge_app_1

CodePudding user response:

The problem comes from your script you are using a #!/bin/bash and that bash is not available in the default packages of alpine. Using #!/bin/sh should fix the problem.

  • Related