我正在为一个简单的rails/postgres应用程序构建码头容器。rails应用程序已经启动,并且正在监听3000端口。我把钢轨集装箱的3000端口暴露出来了。然而,正在使用ERR_EMPTY_RESPONSE进行响应。我认为rails容器应该可以在3000端口上访问。还有什么需要我做的吗?
greg@MemeMachine ~ $ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
我正在为一个应用程序和一个数据库创建两个坞容器。在第一次启动docker-compose up时,应用程序正在运行。然而,在以下几次尝试中,似乎:
Database 'time_distribution_production' already exists.
ActiveRecord::ProtectedEnvironmentError: You are attempting to run a destructive action against your 'production' database.
If you are sure you want to co
并发允许我在同一个终端中同时运行客户机和服务器,它的命令是来自我的服务器文件夹的npm run dev。
我试图避免为客户端和服务器文件夹创建多个Dockerfile。
在构建了整个项目并对其进行映像之后,是否可以使用docker run [image]调用CMD or ENTRYPOINT [npm run dev]来复制与在docker之外启动应用程序相同的行为?如何格式化我的DockerFile以进入服务器文件夹并运行npm run dev来加载客户端和服务器?
我尝试了一下我的代码,显然我得到的错误是docker: Error response from daemon: OCI run
我通过docker-compose创建了一个Docker镜像和容器,其中包含一个由PostgreSQL支持的Rails应用程序。Rails是通过一个docker-entrypoint.sh文件启动的,该文件如下所示: #!/bin/sh
# Exit early if there are any errors.
set -e
# Check that there won't be any server conflicts.
if [ -f tmp/pids/server.pid ]; then
rm tmp/pids/server.pid
fi
# -b binds the
假设有一个简单的Dockerfile FROM php-fpm:8
ADD entrypoint.sh .
RUN chmod +x entrypoint.sh
ENTRYPOINT ["./entrypoint.sh"]
CMD ["php-fpm"] 在入口点脚本中,我只是导出一个变量并打印环境 #!/bin/bash
set -e
export FOO=bar
env // just print the environment while entry point is running
exec "$@" 然后,我将映像构建为myim
我有一个多级Dockerfile:
FROM ruby:2.7.6 as base
ENV RAILS_ENV production
RUN apt-get update
RUN apt-get install -y \
nodejs \
npm \
vim
RUN npm install -g yarn
COPY . /app
WORKDIR /app
RUN gem install bundler
RUN bundle config set --local deployment 'true'
RUN bundle config set --
我使用
4.2.5.1运行中的witin集装箱
Ruby2.3.1运行wit容器
当我开始
$ docker-compose exec web /bin/bash # ssh into the web server
$ bundle exec rails c
我得到了以下错误。
from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.1/lib/bundler/runtime.rb:86:in `each'
from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-
在运行命令rails generate model Setting target:text之后,我将得到下一个错误。
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 4.1.6) depends on
bundler (< 2.0, >= 1.3.0)
Current Bundler version:
bundler (1.0.15)
这意味着它列出了一个看起来没有安装在我的机器上的绑定器版本。
一些细节:
Ub
运行docker run myapp时,我收到以下错误
好了!无法加载应用程序: SocketError: getaddrinfo:名称或服务不知名的bundler:未能加载命令: puma (/usr/local/bundle/bin/puma)
下面是我的配置和Dockerfiles:
应用程序中的DockerFile
FROM ruby:2.5.0
# Set an environment variable where the Rails app is installed to inside of Docker image
ENV RAILS_ROOT /Users/admin/
我正在尝试在docker上用webpacker设置Rails6,一旦docker完成,我就会收到一个奇怪的错误:
Errno::ENOENT: No such file or directory - getcwd
一旦我在容器中使用ssh,我就会得到如下结果:
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
这是我的DockerFile:
ARG RUBY_VERSION
# See explanation be