123456789_123456789_123456789_123456789_123456789_

You can get version 1.6.1 to work in a docker image by using the below file contents.

File: Dockerfile

FROM  ubuntu:latest

RUN apt-get update
RUN apt-get install -y make curl

# ruby's nokorigi is sometimes described as being 'hard' to install, but the below 2 instructions, bundled with the version specified in Gemfile* make it install nicely
RUN echo 'LC_ALL="en_US.UTF-8"' > /etc/default/locale
RUN apt-get install -y ruby1

# greatly speeds up nokogiri install
ENV NOKOGIRI_USE_SYSTEM_LIBRARIES 1
# dependencies for nokogiri gem
RUN apt-get install -y libxml2 libxml2-dev libxslt1-dev

# install bundler
RUN gem install bundler

# install gems
ADD Gemfile /tmp/
ADD Gemfile.lock /tmp/
RUN cd /tmp; bundle install

File: Gemfile

source 'https://rubygems.org'

gem 'nokogiri', '>=1.6.1'

File: Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    nokogiri (1.6)
      mini_portile (~> 0.5)

PLATFORMS
  ruby

DEPENDENCIES
  nokogiri
  rspec
  thor