Hi,
I have some question if it’s possible:
I built a project in Nodejs- in Docker,
And I wont connect it to mongodb container,
the mongo db container run with the data- without problems:
cdrachelllinux@DESKTOP-R9ESLDU:/mnt/c`Preformatted text`/Users/RachelCohen$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9a3bcc06c95d mongo "docker-entrypoint.s…" 12 hours ago Up 12 hours 27017/tcp mongodb
The node js project can connect to regular mongodb (not mongo Docker container) ,
and when I connect it to mongo container- with connectionstring,
mongoose.connect(`process.env.MONGODB_CONNSTRING`,{
and build the node js project image, and run the node project container-
it’s exited immediately
when I checked what is the problem I got:
cdrachelllinux@DESKTOP-R9ESLDU:/mnt/c/Users/RachelCohen/DockerProject/ApiGenerator$ docker run --name kjh -p 3070:3070 r
achelc8/cdcdcdcdcdcdm .
**/usr/local/bin/docker-entrypoint.sh: exec: line 11: .: Permission denied**
the node Dockerfile is:
FROM node:lts-alpine
ENV NODE_ENV=production
WORKDIR /usr/src/app
COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]
RUN npm install --production --silent && mv node_modules ../
COPY . .
EXPOSE 3070
RUN chown -R node /usr/src/app
USER node
CMD ["npm", "start"]
when I tried this:
chmod +x entrypoint.sh
I got:
chmod: cannot access 'entrypoint.sh': No such file or directory
and when I added entrypoint to the Dockerfile:
FROM node:lts-alpine
ENV NODE_ENV=production
WORKDIR /usr/src/app
COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]
RUN npm install --production --silent && mv node_modules ../
COPY . .
EXPOSE 3070
RUN chown -R node /usr/src/app
USER node
**ENTRYPOINT ["/docker-entrypoint.sh"]**
CMD ["npm", "start"]
(and build and ran again) I got:
cdrachelllinux@DESKTOP-R9ESLDU:/mnt/c/Users/RachelCohen/DockerProject/ApiGenerator$ docker run --name kcdjh -p 3070:3070
rachelc8/cdcdcdcdcdcdmp .
docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/docker-entrypoint.sh": stat /docker-entrypoint.sh: no such file or directory: unknown.
ERRO[0002] error waiting for container: context canceled
If you know what the problem is-
It will help me a lot!
thank you!