【发布时间】:2017-10-09 17:24:08
【问题描述】:
我正在尝试将我的 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 行。
【问题讨论】:
标签: postgresql docker elixir docker-compose phoenix-framework