Code Monkey home page Code Monkey logo

rails's Introduction

DEPRECATED

This image is officially deprecated in favor of the standard ruby image, and will receive no further updates after 2016-12-31 (Dec 31, 2016). Please adjust your usage accordingly.

For most usages of this image, it was already not bringing in rails from this image, but actually from your project's Gemfile, so the only "value" being added here was the pre-installing of nodejs, mysql-client, postgresql-client, and sqlite3 for various uses of the rails framework.

For example, a Dockerfile similar to the following would be a good starting point for a Rails project using PostgreSQL:

FROM ruby:2.3

RUN apt-get update \
	&& apt-get install -y --no-install-recommends \
		postgresql-client \
	&& rm -rf /var/lib/apt/lists/*

WORKDIR /usr/src/app
COPY Gemfile* ./
RUN bundle install
COPY . .

EXPOSE 3000
CMD ["rails", "server", "-b", "0.0.0.0"]

About this Repo

This is the Git repo of the Docker official image for rails. See the Docker Hub page for the full readme on how to use this Docker image and for information regarding contributing and issues.

The full readme is generated over in docker-library/docs, specifically in docker-library/docs/rails.

See a change merged here that doesn't show up on the Docker Hub yet? Check the "library/rails" manifest file in the docker-library/official-images repo, especially PRs with the "library/rails" label on that repo. For more information about the official images process, see the docker-library/official-images readme.


rails's People

Contributors

docker-library-bot avatar ianks avatar johnallen3d avatar tianon avatar yanchek99 avatar yosifkit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rails's Issues

Issue using boot2docker

Hi, i'm trying to use rails image with boot2docker on OSX, and I have the following error trying to create a rails app:

# docker run -it --rm --user "$(id -u):$(id -g)" -v "$(pwd)":/usr/src/app -w /usr/src/app rails rails new my_app
      create
/usr/local/lib/ruby/2.2.0/fileutils.rb:252:in `mkdir': Permission denied @ dir_s_mkdir - /usr/src/app/my_app (Errno::EACCES)
    from /usr/local/lib/ruby/2.2.0/fileutils.rb:252:in `fu_mkdir'
    from /usr/local/lib/ruby/2.2.0/fileutils.rb:226:in `block (2 levels) in mkdir_p'
    from /usr/local/lib/ruby/2.2.0/fileutils.rb:224:in `reverse_each'
    from /usr/local/lib/ruby/2.2.0/fileutils.rb:224:in `block in mkdir_p'
    from /usr/local/lib/ruby/2.2.0/fileutils.rb:210:in `each'
    from /usr/local/lib/ruby/2.2.0/fileutils.rb:210:in `mkdir_p'
    from /usr/local/bundle/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:50:in `block in invoke!'
    from /usr/local/bundle/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:116:in `call'
    from /usr/local/bundle/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:116:in `invoke_with_conflict_check'
    from /usr/local/bundle/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:49:in `invoke!'
    from /usr/local/bundle/gems/thor-0.19.1/lib/thor/actions.rb:94:in `action'
    from /usr/local/bundle/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:14:in `empty_directory'
    from /usr/local/bundle/gems/railties-4.2.0/lib/rails/generators/app_base.rb:138:in `create_root'
    from (eval):1:in `create_root'
    from /usr/local/bundle/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /usr/local/bundle/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /usr/local/bundle/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all'
    from /usr/local/bundle/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each'
    from /usr/local/bundle/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map'
    from /usr/local/bundle/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all'
    from /usr/local/bundle/gems/thor-0.19.1/lib/thor/group.rb:232:in `dispatch'
    from /usr/local/bundle/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /usr/local/bundle/gems/railties-4.2.0/lib/rails/commands/application.rb:17:in `<top (required)>'
    from /usr/local/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/local/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/local/bundle/gems/railties-4.2.0/lib/rails/cli.rb:14:in `<top (required)>'
    from /usr/local/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/local/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/local/bundle/gems/railties-4.2.0/bin/rails:9:in `<top (required)>'
    from /usr/local/bundle/bin/rails:23:in `load'
    from /usr/local/bundle/bin/rails:23:in `<main>'

I tried passing real IDs for user and group instead of commands and had the same issue.
Any idea?

rake db:structure tasks fails without postgresql-client package

root@37939cbdd929:/vagrant# bundle exec rake db:migrate
rake aborted!
Error dumping database
/vagrant/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.5/lib/active_record/tasks/postgresql_database_tasks.rb:55:in `structure_dump'
/vagrant/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.5/lib/active_record/tasks/database_tasks.rb:150:in `structure_dump'
/vagrant/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.5/lib/active_record/railties/databases.rake:269:in `block (3 levels) in <top (required)>'
/vagrant/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.5/lib/active_record/railties/databases.rake:43:in `block (2 levels) in <top (required)>'
/vagrant/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.5/lib/active_record/railties/databases.rake:37:in `block (2 levels) in <top (required)>'

In file .../activerecord-4.1.5/lib/active_record/tasks/postgresql_database_tasks.rb:

      def structure_dump(filename)
        set_psql_env
        search_path = configuration['schema_search_path']
        unless search_path.blank?
          search_path = search_path.split(",").map{|search_path_part| "--schema=#{Shellwords.escape(search_path_part.strip)}" }.join(" ")
        end

        command = "pg_dump -i -s -x -O -f #{Shellwords.escape(filename)} #{search_path} #{Shellwords.escape(configuration['database'])}"
        raise 'Error dumping database' unless Kernel.system(command)

        File.open(filename, "a") { |f| f << "SET search_path TO #{ActiveRecord::Base.connection.schema_search_path};\n\n" }
      end

      def structure_load(filename)
        set_psql_env
        Kernel.system("psql -q -f #{Shellwords.escape(filename)} #{configuration['database']}")
      end

Almost same thing with mysql.

    def structure_dump(filename)
        args = prepare_command_options('mysqldump')
        args.concat(["--result-file", "#{filename}"])
        args.concat(["--no-data"])
        args.concat(["#{configuration['database']}"])
        unless Kernel.system(*args)
          $stderr.puts "Could not dump the database structure. "\
                       "Make sure `mysqldump` is in your PATH and check the command output for warnings."
        end
      end

      def structure_load(filename)
        args = prepare_command_options('mysql')
        args.concat(['--execute', %{SET FOREIGN_KEY_CHECKS = 0; SOURCE #{filename}; SET FOREIGN_KEY_CHECKS = 1}])
        args.concat(["--database", "#{configuration['database']}"])
        Kernel.system(*args)
      end

So, without these utils you cannot run db:structure tasks.

Host key verification failed

I have some private repositories being used in my Gemfile but cannot access them when this image runs bundle install.

What is the proper way to get ssh keys verified with Github using boot2docker and this library?

Failing on build

I used the exact Dockerfile that was in this repository, it would not run rails and errored out on that command. So I changed the base image from ruby to rails. Now everything builds and runs, but the app is still not available. Any help would be much appreciated.

Logs go to a file instead of STDOUT

I hadn't played around much with the rails image before this week, but I noticed that the logs are be written to the default logs/#{Rails.env}.log file instead of STDOUT.

I think the fix will need to be made for each app that is based on this image (or pretty much any other Dockerized Rails app), so I don't think there's anything to be done in the image itself. I believe the only thing that should be done is to document the issue over at docker-library/docs, so let me know if I should have opened the issue there. At least having the issue in this repo will help people find it if they search for the problem.

The Rails docs show a quick & dirty approach to logging to STDOUT: http://guides.rubyonrails.org/debugging_rails_applications.html#the-logger

There are also things like Heroku's rails_stdout_logging gem: https://github.com/heroku/rails_stdout_logging

ONBUILD conflicts with items that need to be installed first

ONBUILD is running "bundle install" as soon as my Dockerfile is run. This appears to be correct behavior.

But one of my gems, 'tiny_tds' requires 'freetds' it to be installed first. I can't install it first because ONBUILD is running first. The same thing would happen if Postgres or MySQL were not installed before the bundle install.

Is there a way to handle this scenario?

Ruby 2.3

Is there any plan to use ruby 2.3?

Thanks

Undefined method for an in-built Ruby method - only occuring in Docker images

I have the following Image:
FROM rails:4.2.0

Copy Rails app

COPY . /apps
WORKDIR /apps
RUN bundle install
VOLUME ["/var/log/spree-vend"]
EXPOSE 3000

And have the following undefined method error for the built-in PP method, occurring only, within the Docker image called within a controller..

Processing by VendInventoryController#update as
Apr 10 16:27:25 stg.okla.co.uk production.log: I, [2015-04-10T14:27:25.717912 #1] INFO -- : Parameters: {"domain_prefix"=>"oklahoma", "type"=>"inventory.update", "payload"=>"{"id":"8dac979f-2a43-fda1-fd29-d566c586ce60","product_id":"b8ca3a6e-7230-11e4-efc6-a7a97d2062f7","outlet_id":"bc305bf5-da30-11e4-f357-ddfb498dd76e","attributed_cost":"1.25","count":"40","reorder_point":"3","restock_level":"12","product":{"id":"b8ca3a6e-7230-11e4-efc6-a7a97d2062f7","sku":"13211","handle":"KatieLeamoncardcongratswreath","source":"USER","active":"1","name":"Katie Leamon card congrats wreath","base_name":"Katie Leamon card congrats wreath","description":"","supply_price":"1.25","taxes":[{"outlet_id":"bc305bf5-da30-11e4-f357-ddfb498dd76e","tax_id":"9ad7f284-d87d-11e2-a415-bc764e10976c"},{"outlet_id":"ea7bc68f-b40e-11e3-a0f5-b8ca3a64f8f4","tax_id":"9ad7f284-d87d-11e2-a415-bc764e10976c"},{"outlet_id":"bc305bf5-da30-11e4-f357-ddfb498dd76e","tax_id":"9ad7f284-d87d-11e2-a415-bc764e10976c"}]},"outlet":{"id":"9adf8a87-d87d-11e2-a415-bc764e10976c","name":"Oklahoma Gift","time_zone":"Europe/London","tax_id":"9ad7f284-d87d-11e2-a415-bc764e10976c"}}", "version"=>"1"}
Apr 10 16:27:25 stg.okla.co.uk production.log: E, [2015-04-10T14:27:25.722798 #1] ERROR -- : Exception occured: NoMethodError - undefined method pp' for #<VendInventoryController:0x007fbfccc8b688> Apr 10 16:27:25 stg.okla.co.uk production.log: E, [2015-04-10T14:27:25.722880 #1] ERROR -- : Exception backtrace: Apr 10 16:27:25 stg.okla.co.uk production.log: E, [2015-04-10T14:27:25.723016 #1] ERROR -- : => /apps/app/controllers/base_controller.rb:16:inparse_request'
Apr 10 16:27:25 stg.okla.co.uk production.log: E, [2015-04-10T14:27:25.723096 #1] ERROR -- : => /usr/local/bundle/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:427:in block in make_lambda' Apr 10 16:27:25 stg.okla.co.uk production.log: E, [2015-04-10T14:27:25.723175 #1] ERROR -- : => /usr/local/bundle/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:163:incall'
Apr 10 16:27:25 stg.okla.co.uk production.log: E, [2015-04-10T14:27:25.723268 #1] ERROR -- : => /usr/local/bundle/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:163:in block in halting' Apr 10 16:27:25 stg.okla.co.uk production.log: E, [2015-04-10T14:27:25.723353 #1] ERROR -- : => /usr/local/bundle/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:92:incall'
Apr 10 16:27:25 stg.okla.co.uk production.log: E, [2015-04-10T14:27:25.723423 #1] ERROR -- : => /usr/local/bundle/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:92:in _run_callbacks' Apr 10 16:27:25 stg.okla.co.uk production.log: E, [2015-04-10T14:27:25.723508 #1] ERROR -- : => /usr/local/bundle/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:734:in_run_process_action_callbacks'
Apr 10 16:27:25 stg.okla.co.uk production.log: E, [2015-04-10T14:27:25.723579 #1] ERROR -- : => /usr/local/bundle/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:81:in run_callbacks' Apr 10 16:27:25 stg.okla.co.uk production.log: E, [2015-04-10T14:27:25.723648 #1] ERROR -- : => /usr/local/bundle/gems/actionpack-4.2.0/lib/abstract_controller/callbacks.rb:19:inprocess_action'
Apr 10 16:27:25 stg.okla.co.uk production.log: E, [2015-04-10T14:27:25.723746 #1] ERROR -- : => /usr/local/bundle/gems/actionpack-4.2.0/lib/action_controller/metal/rescue.rb:29:in process_action' Apr 10 16:27:25 stg.okla.co.uk production.log: D, [2015-04-10T14:27:25.726717 #1] DEBUG -- : Exception raised: NoMethodError: undefined methodpp' for #VendInventoryController:0x007fbfccc8b688

bundler error with any gem from git

When I have gems, spefcified in gemfile with:git, running container fails with bundler error.

Gemfile:

# secure token auth for devise
gem 'simple_token_authentication', git: 'https://github.com/gonzalo-bulnes/simple_token_authentication.git'

Error:

[ivko@thinkpad-e530 test]$ docker run -p 3000 --link test-postgres:postgres test
/usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.7.3/lib/bundler/source/git/git_proxy.rb:151:
in `allowed_in_path': The git source https://github.com/gonzalo-bulnes/simple_token_authentication.git
is not yet checked out. Please run `bundle install` before trying to start your application 
(Bundler::GitError)

Some Stack overflow answers suggest to use --path bundler option.

The rails account in Docker Hub

Hi, I have tried to figure this out through different channels without luck. Let my try here, but feel free to close if you can't help.

I am a Rails core team member, and want to register a "rails" account to share an image for Rails core development. That is, someone willing to contribute a patch to Rails would fetch the image and create containers where all is set to tinker and run the test suites. This would be an alternative to our current rails-dev-box. As you see it has a different goal than this official rails image.

Docker Hub says the "rails" username is taken (same for an organization namespace), but https://hub.docker.com/u/rails/ yields a 404. Could it be the case that Docker Hub disallows accounts named as one of their official repositories?

rails:onbuild does not work with engines in subfolders

Hi,
In our Rails application we have engines which are referenced in our Gemfile e.g:

gem 'foo', path: 'engines/foo'

This is problematic since the rails:onbuild image does ONBUILD COPY . /usr/src/app after ONBUILD RUN bundle install hence producing this kind of error:

The path `/usr/src/app/engines/foo` does not exist.
2014/12/17 11:15:48 The command [/bin/sh -c bundle install] returned a non-zero code: 13

I am not an expert at Rails apps but I think this is a common practice ; I there a specific reason I don't know about for running bundle install before copying the files ?
Can someone tell me if we are doing something wrong with our Gemfile ?

If there is no specific reason, since Gemfile and Gemfile.lock are generally kept under version control, I'd suggest to replace:

ONBUILD COPY Gemfile /usr/src/app/
ONBUILD COPY Gemfile.lock /usr/src/app/
ONBUILD RUN bundle install

ONBUILD COPY . /usr/src/app

by

ONBUILD COPY . /usr/src/app
ONBUILD RUN bundle install

Tell me what you think ; I'd be pleased to make a PR for this.

Don't install rmagick gem

rmagick gem insn't installed even with all dependencies.

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb 

checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... no
Can't install RMagick 0.0.0. Can't find Magick-config in /usr/local/bundle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/ruby

extconf failed, exit code 1

Gem files will remain installed in /usr/local/bundle/gems/rmagick-2.13.3 for inspection.
Results logged to /usr/local/bundle/extensions/x86_64-linux/2.1.0-static/rmagick-2.13.3/gem_make.out
An error occurred while installing rmagick (2.13.3), and Bundler cannot
continue.
Make sure that gem install rmagick -v '2.13.3' succeeds before bundling.
Service 'web' failed to build: The command [/bin/sh -c bundle install] returned a non-zero code: 5

Issue while installing birch

Hi,
I am having trouble when building a docker container. I have a rails app and in the docker file, I use
FROM rails:onbuild.
But when I build the container, I get the following error:

`Installing birch 0.0.8 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /usr/local/bundle/gems/birch-0.0.8/ext/birch

/usr/local/bin/ruby -r ./siteconf20160204-7-z7y8lb.rb extconf.rb
creating Makefile

current directory: /usr/local/bundle/gems/birch-0.0.8/ext/birch
make "DESTDIR=" clean

current directory: /usr/local/bundle/gems/birch-0.0.8/ext/birch
make "DESTDIR="
compiling native.c
native.c: In function 'birch_edge_initialize':
native.c:42:8: warning: unused variable 'direction' [-Wunused-variable]
VALUE direction;
^
native.c:41:8: warning: unused variable 'directed' [-Wunused-variable]
VALUE directed;
^
native.c:40:8: warning: unused variable 'node_b' [-Wunused-variable]
VALUE node_b;
^
native.c:39:8: warning: unused variable 'node_a' [-Wunused-variable]
VALUE node_a;
^
native.c: In function 'birch_has_features':
native.c:272:3: warning: implicit declaration of function 'RHASH' [-Wimplicit-function-declaration]
if (!RHASH(features)->ntbl) {
^
native.c:272:23: error: invalid type argument of '->' (have 'int')
if (!RHASH(features)->ntbl) {
^
native.c: In function 'birch_edge_initialize':
native.c:58:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
native.c: In function 'birch_has_features':
native.c:275:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
Makefile:237: recipe for target 'native.o' failed
make: *** [native.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/bundle/gems/birch-0.0.8 for inspection.
Results logged to /usr/local/bundle/extensions/x86_64-linux/2.2.0-static/birch-0.0.8/gem_make.out
`

I was able to solve is by using the contents of the dockerfile and changing ruby from 2.2 to 2.1.5

I understand its not your issue but informing you so it can help !

Need libxml2-dev libxslt1-dev to build rails

Not sure which image your From ruby:2.2 stands for. I suppose it would be the image build from here: https://github.com/docker-library/ruby/tree/master/2.2

Then I tried to build on top of which I've build with wheezy image, then I found the following patch was needed to finish building.

  diff -ub rails/Dockerfile Dockerfile
--- rails/Dockerfile    2015-05-26 16:18:13.650495822 +0800
+++ Dockerfile  2015-05-26 16:26:18.415989564 +0800
@@ -1,11 +1,19 @@
 FROM ruby:2.2

 # see update.sh for why all "apt-get install"s have to stay as one long line
-RUN apt-get update && apt-get install -y nodejs --no-install-recommends && rm -rf /var/lib/apt/lists/*
-
+RUN curl -sL https://deb.nodesource.com/setup | bash - \
+        && apt-get update \
+        && apt-get install -y nodejs --no-install-recommends \
+        && rm -rf /var/lib/apt/lists/*
 # see http://guides.rubyonrails.org/command_line.html#rails-dbconsole
-RUN apt-get update && apt-get install -y mysql-client postgresql-client sqlite3 --no-install-recommends && rm -rf /var/lib/apt/lists/*
-
+RUN apt-get update \
+        && apt-get install -y mysql-client postgresql-client sqlite3 \
+        && libxml2-dev libxslt1-dev --no-install-recommends \
+        && rm -rf /var/lib/apt/lists/*
 ENV RAILS_VERSION 4.2.1
+RUN gem install nokogiri -- --use-system-libraries
 RUN gem install rails --version "$RAILS_VERSION"

Rails 4.2 Not Accessible on Host

I used the onbuild image to create a new Rails 4.2 application but was having difficulty accessing it (Boot2Docker on OSX). It turns out there was a change with the release 4.2 so that by default in development mode applications listen on localhost vs 0.0.0.0. Essentially this means (to the best of my understanding) that the web server is only accessible from inside of the running container. In order to access my server externally (ie. on the host machine) I had to do something like: rails s -b 0.0.0.0 Perhaps this option should be added to the default command in the onbuild image?

Err http://httpredir.debian.org jessie InRelease

use Dockerfile

FROM ruby:2.3

# see update.sh for why all "apt-get install"s have to stay as one long line
RUN apt-get update && apt-get install -y nodejs --no-install-recommends && rm -rf /var/lib/apt/lists/*

# see http://guides.rubyonrails.org/command_line.html#rails-dbconsole
RUN apt-get update && apt-get install -y mysql-client --no-install-recommends && rm -rf /var/lib/apt/lists/*

ENV RAILS_VERSION 5.0.0.beta2

RUN gem sources --add https://ruby.taobao.org/ --remove https://rubygems.org/ && gem install rails --version "$RAILS_VERSION"

ENV BUNDLE_APP_CONFIG .bundle

RUN mkdir /data
WORKDIR /data

bulid command:

docker build -t myrails .

Sending build context to Docker daemon 19.97 kB
Step 1 : FROM ruby:2.3
 ---> e4b689e9dc8b
Step 2 : RUN apt-get update && apt-get install -y nodejs --no-install-recommends && rm -rf /var/lib/apt/lists/*
 ---> Running in 060f7b8d65f7
Err http://httpredir.debian.org jessie InRelease

Err http://httpredir.debian.org jessie-updates InRelease

Err http://security.debian.org jessie/updates InRelease

Err http://httpredir.debian.org jessie Release.gpg
  Could not resolve 'httpredir.debian.org'
Err http://security.debian.org jessie/updates Release.gpg
  Could not resolve 'security.debian.org'
Err http://httpredir.debian.org jessie-updates Release.gpg
  Could not resolve 'httpredir.debian.org'
Reading package lists...
W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie/InRelease  

W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie-updates/InRelease  

W: Failed to fetch http://security.debian.org/dists/jessie/updates/InRelease  

W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie/Release.gpg  Could not resolve 'httpredir.debian.org'

W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie-updates/Release.gpg  Could not resolve 'httpredir.debian.org'

W: Failed to fetch http://security.debian.org/dists/jessie/updates/Release.gpg  Could not resolve 'security.debian.org'

W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package nodejs
The command '/bin/sh -c apt-get update && apt-get install -y nodejs --no-install-recommends && rm -rf /var/lib/apt/lists/*' returned a non-zero code: 100

how can solve this probles......

OpenSSL / Default CA issues with latest Rails images

$ docker run -it rails:4.2.5.1 curl -v https://api.outbrain.com
* Rebuilt URL to: https://api.outbrain.com/
* Hostname was NOT found in DNS cache
*   Trying 50.31.185.57...
* Connected to api.outbrain.com (50.31.185.57) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS alert, Server hello (2):
* SSL certificate problem: unable to get local issuer certificate
* Closing connection 0
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.



$ docker run -it rails:4.2.4 curl -v https://api.outbrain.com
* Rebuilt URL to: https://api.outbrain.com/
* Hostname was NOT found in DNS cache
*   Trying 64.74.232.58...
* Connected to api.outbrain.com (64.74.232.58) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* Server certificate:
*    subject: C=US; ST=New York; L=New York; O=Outbrain Inc.; OU=Operations; CN=*.outbrain.com
*    start date: 2014-10-20 00:00:00 GMT
*    expire date: 2016-12-18 23:59:59 GMT
*    subjectAltName: api.outbrain.com matched
*    issuer: C=US; O=thawte, Inc.; CN=thawte SSL CA - G2
*    SSL certificate verify ok.
> GET / HTTP/1.1
> User-Agent: curl/7.38.0
> Host: api.outbrain.com
> Accept: */*
>
< HTTP/1.1 302 Found
< Cache-Control: no-cache
< Content-length: 0
< Location: http://www.outbrain.com/?proxy-redirect=1
< Connection: close
<
* Closing connection 0
* SSLv3, TLS alert, Client hello (1):

'Connection timed out' with bundle install

I ran into this error on a company server probably protected by proxy and firewall. I could not change the configuration. This was the error output:

fatal: unable to connect to github.com:
github.com[0: 192.30.252.128]: errno=Connection timed out

Retrying git clone 'git://github.com/rweng/jquery-datatables-rails.git' "/usr/local/bundle/cache/bundler/git/jquery-datatables-rails-b8d699e208e47fe51869a7aebe3d593ff0672f4a" --bare --no-hardlinks --quiet due to error (2/4): Bundler::Source::Git::GitCommandError Git error: command `git clone 'git://github.com/rweng/jquery-datatables-rails.git' "/usr/local/bundle/cache/bundler/git/jquery-datatables-rails-b8d699e208e47fe51869a7aebe3d593ff0672f4a" --bare --no-hardlinks --quiet` in directory /usr/src/app has failed.

I could solve this by globally change git:// into https:// in the Dockerfile before the ONBUILD instructions:

# solves 'Connection time out' on server in company domain.
RUN git config --global url."https://".insteadOf git://

I do not know if this works in all situations, however.

Can this be used in production?

Am I correct in saying this uses web brick? And if so does this mean that is should not be used in production?

Thanks in advance

Tim

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.