简体   繁体   English

Docker错误:standard_init_linux.go:185:exec用户进程导致“没有这样的文件或目录”

[英]Docker error: standard_init_linux.go:185: exec user process caused “no such file or directory”

I'm trying to set my elixir-phoenix app with postgresql database to run with Docker. 我正在尝试使用postgresql数据库设置我的elixir-phoenix应用程序以使用Docker运行。 This is what my Dockerfile looks like: 这就是我的Dockerfile的样子:

# ./Dockerfile

# Starting from the official Elixir 1.5.2 image:
# https://hub.docker.com/_/elixir/
FROM elixir:1.5.2

ENV DEBIAN_FRONTEND=noninteractive

# Install hex
RUN mix local.hex

# Install rebar
RUN mix local.rebar

# Install the Phoenix framework itself
RUN mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez

# Install NodeJS 6.x and the NPM
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
RUN apt-get install -y -q nodejs

# Set /lib as workdir
WORKDIR /lib

And this is my docker-compose.yml file: 这是我的docker-compose.yml文件:

web:
  build: .
  dockerfile: Dockerfile 
  env_file: .env 
  command: mix phx.server # Start the server if no other command is specified
  environment:
    - MIX_ENV=dev
    - PORT=4000
    - PG_HOST=postgres
    - PG_USERNAME=postgres
  volumes:
    - .:/lib 
  ports:
    - "4000:4000"
  links:
    - postgres

test:
  image: phoenixbootstrap_web
  env_file: .env
  command: mix test
  environment:
    - MIX_ENV=test 
    - PORT=4001
    - PG_HOST=postgres
    - PG_USERNAME=postgres
  volumes_from:
    - web
  links:
    - postgres

postgres:
  image: postgres:10.0
  ports:
    - "5432"

The image builds successfully, but when I try to install the dependencies with the following command: 图像构建成功,但是当我尝试使用以下命令安装依赖项时:

docker-compose run web mix do deps.get

I get these Error: 我得到这些错误:

standard_init_linux.go:185: exec user process caused "no such file or directory"

PS: I found a couple of answers like this one , pointing out a missing line at the beginning of a bash file but it doesn't seem to be my case. PS:我发现了一些像这样的答案,在bash文件的开头指出了一条缺失的行,但它似乎不是我的情况。 I run no bash script and my error appears in line 185, not 179. 我没有运行bash脚本,我的错误出现在第185行,而不是179。

Like you mentioned, one cause could be that the bash file is missing #!/bin/bash at the top. 就像你提到的,一个原因可能是bash文件在顶部缺少#!/bin/bash

Another possible reason could be if the file is saved with Windows line endings (CRLF). 另一个可能的原因可能是文件是使用Windows行结尾(CRLF)保存的。 Save it with Unix line endings (LF) and it will be found. 使用Unix行结尾(LF)保存它,它将被找到。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 postgres docker以代码1退出,而exec用户进程导致“无此文件或目录” - postgres docker exits with code 1 and exec user process caused “no such file or directory” Docker:OCI 运行时创建失败:container_linux.go:349:启动容器进程导致“exec:\”java\“:$PATH 中找不到可执行文件” - Docker: OCI runtime create failed: container_linux.go:349: starting container process caused “exec: \”java\“: executable file not found in $PATH” wiki.js exec 用户进程导致:postgress 容器上的 exec 格式错误 - wiki.js exec user process caused: exec format error on postgress container Postgres,Go Docker编写wait-for-it.sh没有此类文件或目录 - Postgres, Go Docker compose wait-for-it.sh no such file or directory init.sql 作为目录添加到 docker-compose 与 postgressql - init.sql is added as directory in docker-compose with postgressql docker postgres 初始化脚本似乎不会创建数据库用户,命令被忽略 - docker postgres init script seems will not create db user, command is ignored 从 docker-compose 收到错误,提示用户必须拥有数据目录 - Receiving an error from a docker-compose that the user must own the data directory PostgreSQL 12 和 PostGIS 3.0.1:错误:无法访问文件“$libdir/postgis-3”:Linux 上没有此类文件或目录 - PostgreSQL 12 and PostGIS 3.0.1: ERROR: could not access file "$libdir/postgis-3": No such file or directory on Linux 在 Docker 中使用带有 Postgresql 的 sequelize:Libpq 依赖 Exec 格式错误 - Using sequelize with Postgresql in Docker: Libpq dependency Exec format error docker-compose postgresql 自定义初始化脚本错误 - docker-compose postgresql custom init script error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM