1

I do some test in the docker which use clean ubuntu14.04. I use the below code to install ruby2.0 in the dockerfile:

RUN apt-add-repository ppa:brightbox/ruby-ng
RUN apt-get update && apt-get -y install \
    ruby2.0 \
    ruby2.0-dev

Then i enter the docker. The issue occur: when i use

apt-get install ruby2.0

there is no question. when i use

apt-get install ruby

after apt-get update, apt will find ruby1.9 to install and overwrite the link(/usr/bin/ruby), which means the default ruby version is 1.9 now.

For further development, i can not specify version. And also, i need to let this operation run well at ubuntu14.04 even i know it can pass at ubuntu16. How can i fix this issue?

And is the apt source in the docker different from ubuntu14.04?

1
  • 1
    Why don't you use ruby's official docker image?
    – Radix
    Commented Jun 5, 2017 at 9:17

1 Answer 1

0

The apt-add-repository doesn't exist. And the official ubuntu:14.04 image doesn't include add-apt-repository by default. You need to install it with

apt-get update && apt-get install software-properties-common

After this, you can install your ruby by,

add-apt-repository -y ppa:brightbox/ruby-ng
apt-get update && apt-get -y install ruby2.0 ruby2.0-dev

I am not sure how your Dockerfile can run without error. But there a tip for you to write a Dockerfile. Always run the command in the container first, before write it to the Dockerfile.

Not the answer you're looking for? Browse other questions tagged or ask your own question.