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
Related
I`ve built a small react and node js app and I would like to build from it a docker image.
This is the Dockerfile that I`ve build:
FROM node:10 AS ui-build
WORKDIR /react-express-example/client/src
COPY client/ ./client/
RUN cd client && npm install && npm run build
FROM node:10 AS server-build
WORKDIR /react-express-example/
COPY --from=ui-build /client/src ./client/src
COPY /react-express-example/package*.json ./react-express-example/
RUN cd react-express-example && npm install
COPY /react-express-example/index.js ./react-express-example/
EXPOSE 5000
CMD ["node", "./react-express-example/index.js"]
This is the file path for the app:
The whole app: C:\nodejs\react-express-example
The react app: C:\nodejs\react-express-example\client
When I build the image with the command: docker -t build react-node-image . I get the error:
=> ERROR [server-build 6/6] COPY /react-express-example/index.js ./react-express-example/ 0.0s
[server-build 6/6] COPY /react-express-example/index.js ./react-express-example/:
failed to solve with frontend dockerfile.v0: failed to build LLB: failed to compute cache key: "/react-express-example/index.js" not found: not found
I am a beginner can please someone help me with writing the Dockerfile correctly according to the path that I`ve given ?
Thanks in advance
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.
I'm want to run aspnetcore 2.2 web app in azure, using windows docker containers,
but container fails starting with following message
ERROR - Site: test-container-bonee - Image pull reported error. Image:
containersbonee.azurecr.io/soarcdockertest:1.0. failed to register
layer: re-exec error: exit status 1: output: remove
\?\C:\DockerData\windowsfilter\1889bb89045f68ca9052065efa6ea07b24da7e725d2adb2aacc8294318fecb6c\UtilityVM\Files\Windows\servicing\Packages\Microsoft-UtilityVM-Core-Package~31bf3856ad364e35~amd64~~10.0.14393.0.cat:
The process cannot access the file because it is being used by another
process.
25/01/2019 10:31:06.022 INFO - Site: test-container-bonee -
Image: containersbonee.azurecr.io/soarcdockertest:1.0 Custom Registry:
https://containersbonee.azurecr.io
25/01/2019 10:31:06.025 INFO - Site: test-container-bonee - Purging
after container failed to start
25/01/2019 10:31:06.025 ERROR - Site:
test-container-bonee - Pull image completed but it was not found
locally. Image: containersbonee.azurecr.io/soarcdockertest:1.0.
Errors: failed to register layer: re-exec error: exit status 1:
output: remove
\?\C:\DockerData\windowsfilter\1889bb89045f68ca9052065efa6ea07b24da7e725d2adb2aacc8294318fecb6c\UtilityVM\Files\Windows\servicing\Packages\Microsoft-UtilityVM-Core-Package~31bf3856ad364e35~amd64~~10.0.14393.0.cat:
The process cannot access the file because it is being used by another
process.
Here is my dockerfiler
FROM microsoft/dotnet:2.2-aspnetcore-runtime-nanoserver-sac2016 AS base
WORKDIR /app
EXPOSE 80
FROM microsoft/dotnet:2.2-sdk-nanoserver-sac2016 AS build
WORKDIR /src
COPY ["Soarc.DockerTest/Soarc.DockerTest.csproj", "Soarc.DockerTest/"]
RUN dotnet restore "Soarc.DockerTest/Soarc.DockerTest.csproj"
COPY . .
WORKDIR "/src/Soarc.DockerTest"
RUN dotnet build "Soarc.DockerTest.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "Soarc.DockerTest.csproj" -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "Soarc.DockerTest.dll"]
Any ideas how to fix this?
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.
I'm trying to create a container from node js image and I have configured my Dockerfile as shown:
FROM node:boron
# Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Install app dependencies
COPY package.json /usr/src/app
RUN npm install
# Bundle app source
COPY . /usr/src/app
VOLUME ./:/usr/src/app
ENTRYPOINT [ "npm run watch" ]
In the package.json I have a script called watch than runs the gulp task named watch-less.
If I run npm run watch in my local environment the command works but when I try running the container it doesn't and shows the next error:
docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \"npm run watch\": executable file not found in $PATH".
ENTRYPOINT [ "npm run watch" ]
This is an incorrect json syntax, it's looking for the executable npm run watch, not the executable npm with parameters run and watch:
With the json syntax you need to separate each argument. You can use the shell syntax:
ENTRYPOINT npm run watch
Or you can update the json syntax like (assuming npm is installed in /usr/bin):
ENTRYPOINT [ "/usr/bin/npm", "run", "watch" ]
You also have an incorrect volume definition:
VOLUME ./:/usr/src/app
Dockerfiles cannot specify the how the volume is mounted to the host, only that an anonymous volume is defined at a specific directory location. With a syntax like:
VOLUME /usr/src/app
I've got strong opinions against using a volume definition inside of the Dockerfile described in this blog post. In short, you can define the volume better in a docker-compose.yml, all you can do with a Dockerfile is create anonymous volumes that you'd need to still redefine elsewhere if you want to be able to easily reuse them later.
If you use the list notation for ENTRYPOINT, that is, with the [brackets], you must separate the arguments properly.
ENTRYPOINT ["npm", "run", "watch"]
Right now it is trying to find a file literally named "npm run watch" and that does not exist.