postgresql - Docker 错误 : standard_init_linux. go:1

我正在尝试将我的 elixir-phoenix 应用程序与 postgresql 数据库一起设置为与 Docker 一起运行。这就是我的 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

这是我的 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"

镜像构建成功,但是当我尝试使用以下命令安装依赖项时:

docker-compose run web mix do deps.get

我收到这些错误:

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

PS:我找到了几个答案,例如 this one ,指出 bash 文件开头的缺失行,但这似乎不是我的情况。我没有运行 bash 脚本,我的错误出现在第 185 行,而不是第 179 行。

最佳答案

正如您所提到的,一个原因可能是 bash 文件在顶部缺少 #!/bin/bash

另一个可能的原因可能是文件以 Windows 行结尾 (CRLF) 保存。用 Unix 换行符 (LF) 保存它,它就会被找到。

关于postgresql - Docker 错误 : standard_init_linux. go:185: exec 用户进程导致 "no such file or directory",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46651861/

相关文章:

macos - docker 的 `net=host` 设置如何工作,我该如何做类似的事情,例如虚拟

docker - Jenkins Docker 管道退出代码 -1

docker - condas `source activate virtualenv` 在 Doc

typescript - 使用 VS Code 调试在 Docker 容器中使用 ts-node 运

docker - Kubernetes多节点上的Kafka

docker - 如何将文件作为 docker 命令的参数发送?

docker - 根据子域将流量路由到 docker 容器

docker - 如何访问 Docker 容器的 Windows 事件日志

docker - "Empty continuation lines will become err

docker - 停止的 Docker 容器的资源使用情况