gpt4 book ai didi

javascript - docker Node : Entrypoint can't be found

转载 作者:行者123 更新时间:2023-11-30 20:52:54 29 4
gpt4 key购买 nike

我有以下 Dockerfile_dev docker 文件:

FROM node:alpine
MAINTAINER "Desyllas Dimitrios"

ENV NEO4J_HOST=""
ENV NEO4J_USER=""
ENV NEO4J_PASSWORD=""
ENV MONGO_CONNECTION_STRING=""
ENV LOGS_DIR="/var/log/data_map"

COPY ./docker_scripts/entrypoint_dev.sh /usr/local/bin/entrypoint.sh

RUN chmod +x /usr/local/bin/entrypoint.sh &&\
chown root:root /usr/local/bin/entrypoint.sh &&\
mkdir -p /opt/map &&\
mkdir -p /var/log/data_map &&\
chmod 0666 /var/log/data_map

EXPOSE 7474
VOLUME /var/log/data_map
VOLUME /opt/map

WORKDIR /opt/map

ENTRYPOINT ['/usr/local/bin/entrypoint.sh']

我有以下入口点:

#!/bin/sh

cd /opt/map

npm install
npm start

构建镜像是通过下面的 docker-compose 启动的

version: '2'
services:

data_map_dev:
build:
context: .
dockerfile: Dockerfile_dev
image: 'pcmagas/data-map:dev'
links:
- 'neo4j_dev'
- 'mongodb'
volumes:
- './src:/opt/map/src'
- './www:/opt/map/www'
- './package.json:/opt/map/package.json'
- './docker-volumes/app_dev:/var/log/datamap'
ports:
- "9781:9780"
environment:
NEO4J_HOST: 'neo4j_dev'
NEO4J_USER: 'neo4j'
NEO4J_PASSWORD: 'neo4j'
MONGO_CONNECTION_STRING: 'mongodb://mongodb:map_dev'

neo4j_dev:
image: 'neo4j'
ports:
- '7474:7474'
volumes:
- './docker-volumes/neo4j_dev/data:/data'
environment:
NEO4J_AUTH: 'neo4j/neo45j'

mongodb:
image: 'mongo'
ports:
- '27017:27017'
volumes:
- './docker-volumes/mongodb/:/data/db'

我使用 docker-compose build --no-cache --force-rm 构建它,当我通过 docker-compose up 启动它时,它找不到入口点您在消息中看到的脚本:

data_map_dev_1 | /bin/sh: [/usr/local/bin/entrypoint.sh]: not found

你知道为什么吗?我在 my project 上也有类似的问题也是。

最佳答案

您的 JSON 语法错误。

Note: The exec form is parsed as a JSON array, which means that you must use double-quotes (“) around words not single-quotes (‘).

https://docs.docker.com/engine/reference/builder/

像这样切换到双引号:

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

关于javascript - docker Node : Entrypoint can't be found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47977710/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com