starting container process caused "exec: \".\": executable file not found - node.js

i am new in docker. i want to deploy my application node js in docker but i am facing below error kindly help me this
/usr/bin/docker-current: Error response from daemon: oci runtime
error: container_linux.go:247: starting container process caused
"exec: \".\": executable file not found in $PATH".
docker build -t project_account_v1:1.1 .
docker container run -e TZ=Asia/Karachi -d -p 9191:9191 project_account_v1:1.1 .
Dockerfile:
FROM node:8.12
WORKDIR /app
COPY package.json /app
ENV NODE_ENV=production
RUN npm install
COPY . /app
VOLUME ["/app/logs"]
CMD ["node", "/app/app.js"]
EXPOSE 9191

"exec: \".\": executable file not found in $PATH".
Remove the . at the end of the Docker run command.

Related

OCI runtime create failed: runc create failed: unable to start container process

the full error reads like such:
Error invoking remote method 'docker-start-container': Error: (HTTP code 400) unexpected - failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "./dist/index.js": permission denied: unknown
this is a pretty simple dockerfile, for just copying everything into the container, compiling and then running the main file (dist/index.js).
Didn't stumble any errors during build time, only when running.
this is my Dockerfile:
FROM node:18-alpine3.14
WORKDIR .
COPY package*.json ./
COPY tsconfig.json ./
COPY src ./src
COPY .env ./
RUN npm ci
RUN npm run build
RUN chmod +x ./dist
ENTRYPOINT ["./dist/index.js"]
CMD ["node", "index.js"]
didn't find anything about this specific error :(
thanks in advance

Issue with docker permissions

I just learning about docker Volumes.
I have this code aside Node.js project.
this is my Docker file:
FROM node:14
WORKDIR /app
COPY package.json .
RUN npm install
COPY . .
EXPOSE 80
VOLUME [ "./app.feedback" ]
CMD ["node", "server.js"]
and this is my command
docker run -d -p 3000:80 --rm --name feedback-app -v feedback:/app/feedback -v "C:\Users\amit\personal\data-volumes-01-starting-setup:/app" -v /app/node_modules feedback-node:volumes
and this is the error
OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:75: mounting "/var/lib/docker/volumes/ebfb2e17b5bf6768527c205789667de5ca31b29b9a9603297b7fbc2881c95701/_data" to rootfs at "/app/node_modules" caused: mkdir /var/lib/docker/overlay2/87136c8400ec6a42517fb51eb41084c6a6e5825f877addb7dea71af167a7a43d/merged/app/node_modules: permission denied: unknown.
PS C:\Users\amit\personal\data-volumes-01-starting-setup>
Use this base image instead:
FROM node:lts-alpine

Docker Container exits upon running with "sh -c"

I am trying to run a webserver (right now still locally) out of a docker container. I am currently going step by step to understand the different parts.
Dockerfile:
FROM node:12.2.0-alpine as build
ENV environment development
WORKDIR /app
COPY . /app
RUN cd /app/client && yarn && yarn build
RUN cd /app/server && yarn
EXPOSE 5000
CMD ["sh", "-c","NODE_ENV=${environment}", "node", "server/server.js"]
Explanation:
I have the "sh", "-c" part in the CMD command due to the fact that without it I was getting this error:
docker: Error response from daemon: OCI runtime create failed:
container_linux.go:346: starting container process caused "exec:
\"NODE_ENV=${environment}\": executable file not found in $PATH":
unknown.
Building the container:
Building the container works just fine with:
docker build -t auth_example .
It takes a little while since the build context is (even after excluding all the node_modules) roughly 37MB, but that's okay.
Running the container:
Running the container and the app inside works like a charm if I do:
MyZSH: docker run -it -p 5000:5000 auth_example /bin/sh
/app # NODE_ENV=development node server/server.js
However, when running the container via the CMD command like this:
MyZSH: docker run -p 5000:5000 auth_example
Nothing happens, no errors, no nothing. The logs are empty and a docker ps -a reveals that the container was exited right upon start. I did some googling and tried different combinations of -t -i -d but that didn't solve it either.
Can anybody shed some light on this or point me into the right direction?
The problem is you're passing three arguments to sh -c whereas you'd usually pass one (sh -c "... ... ...").
It's likely you don't need the sh -c invocation at all; use /usr/bin/env to alias that environment variable instead (or just directly pass in NODE_ENV instead of environment):
FROM node:12.2.0-alpine as build
ENV environment development
WORKDIR /app
COPY . /app
RUN cd /app/client && yarn && yarn build
RUN cd /app/server && yarn
EXPOSE 5000
CMD /usr/bin/env NODE_ENV=${environment} node server/server.js

How to run an asp dot net core image in Linux?

I am using this docker file to build it
FROM microsoft/dotnet:2.1-sdk-alpine3.7 AS build
WORKDIR /app
COPY Packt.HelloWorld.csproj ./
RUN dotnet restore
COPY . ./
RUN dotnet publish -c Release -o /published
RUN ls -alrth /published
FROM microsoft/dotnet:2.1-runtime-deps-alpine3.7 AS base
WORKDIR /app
COPY --from=build /published .
RUN ls -alrth /app
# ENTRYPOINT ["dotnet", "TestApp.dll"] <-- I can run in Windows like this
ENTRYPOINT ["Packt.HelloWorld"]
The debug ls can show all files under the /app folder
But if I use this
ENTRYPOINT ["/app/Packt.HelloWorld"]
It complained there is no such a path.
docker: Error response from daemon: OCI runtime create failed:
container_linux.go:348: starting container process ca
used "exec: \"/app/Packt.HelloWorld\": stat /app/Packt.HelloWorld: no such file or directory": unknown.
if I use
ENTRYPOINT ["Packt.HelloWorld"]
It gave me
docker: Error response from daemon: OCI runtime create failed:
container_linux.go:348: starting container process caused "exec:
\"Packt.HelloWorld\": executable file not found in $PATH": unknown.
The image seems to build properly and content are also in there, it's just the running not successful.
Can anyone give me a hint what I am missing?
Thanks
# ENTRYPOINT ["dotnet", "TestApp.dll"] <-- I can run in Windows like this
This is pretty much exactly how it should work on Linux as well.
It looks like you are doing Framework Dependent Deployment (no -r or --runtime argument for dotnet publish). So the same steps to build/run on Windows should work on Linux as well.
You need to specify the runtime of the publish subcommand of dotnet-cli. Also, the publishing process must create a self-contained application. Check the link for more information.

Npm not found when running docker container from node image

# Dockerfile
FROM node:7-alpine
RUN mkdir -p /src/app
WORKDIR /src/app
COPY package.json /src/app/package.json
RUN npm install
COPY . /src/app
EXPOSE 3000
CMD ['npm', 'start']
I'm trying to complete a katacoda.com exercise for Dockerizing nodejs applications with the Dockerfile above. The build completes but running the image quits immediately and in the docker logs I see:
/bin/sh: [npm,: not found
I tried running the container in interactive mode with docker -it nodeapp /bin/bash which raised the error docker: Error response from daemon: oci runtime error: container_linux.go:262: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory". So I'm not sure what is going on here.
The reason it doesn't work is single quotes
CMD ['npm', 'start']
should be
CMD ["npm", "start"]
When you don't use double quotes, docker will remove the single quotes and process the command as [npm, start]
That is why you see error [npm, : not found
I had the same symptom but the problem was slightly different. Writing here in case google leads others in my situation to this link For me the issue was forgetting commas in the CMD. So the solution was going from CMD ["npm" "start"] to CMD ["npm", "start"].

Resources